debian-mirror-gitlab/spec/graphql/resolvers/group_resolver_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
924 B
Ruby
Raw Normal View History

2019-09-04 21:01:54 +05:30
# frozen_string_literal: true
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Resolvers::GroupResolver do
2019-09-04 21:01:54 +05:30
include GraphqlHelpers
2020-04-08 14:13:33 +05:30
let_it_be(:group1) { create(:group) }
let_it_be(:group2) { create(:group) }
2019-09-04 21:01:54 +05:30
describe '#resolve' do
it 'batch-resolves groups by full path' do
paths = [group1.full_path, group2.full_path]
2019-12-04 20:38:33 +05:30
result = batch_sync(max_queries: 1) do
2019-09-04 21:01:54 +05:30
paths.map { |path| resolve_group(path) }
end
expect(result).to contain_exactly(group1, group2)
end
it 'resolves an unknown full_path to nil' do
2021-11-11 11:23:49 +05:30
result = batch_sync { resolve_group('unknown/group') }
2019-09-04 21:01:54 +05:30
expect(result).to be_nil
end
2021-11-11 11:23:49 +05:30
it 'treats group full path as case insensitive' do
result = batch_sync { resolve_group(group1.full_path.upcase) }
expect(result).to eq group1
end
2019-09-04 21:01:54 +05:30
end
def resolve_group(full_path)
resolve(described_class, args: { full_path: full_path })
end
end