aa7b1cfc5b
- Due to https://github.com/exAspArk/batch-loader/pull/32, we changed BatchLoader.for into BatchLoader::GraphQL.for - since our results are wrapped in a BatchLoader::GraphQL, calling `sync` during authorization is required to get real object - `graphql` now has it's own authorization system. Our `authorized?` method conflicted and required renaming
32 lines
741 B
Ruby
32 lines
741 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
describe Resolvers::GroupResolver do
|
|
include GraphqlHelpers
|
|
|
|
set(:group1) { create(:group) }
|
|
set(:group2) { create(:group) }
|
|
|
|
describe '#resolve' do
|
|
it 'batch-resolves groups by full path' do
|
|
paths = [group1.full_path, group2.full_path]
|
|
|
|
result = batch_sync(max_queries: 1) do
|
|
paths.map { |path| resolve_group(path) }
|
|
end
|
|
|
|
expect(result).to contain_exactly(group1, group2)
|
|
end
|
|
|
|
it 'resolves an unknown full_path to nil' do
|
|
result = batch_sync { resolve_group('unknown/project') }
|
|
|
|
expect(result).to be_nil
|
|
end
|
|
end
|
|
|
|
def resolve_group(full_path)
|
|
resolve(described_class, args: { full_path: full_path })
|
|
end
|
|
end
|