Welcome to mirror list, hosted at ThFree Co, Russian Federation.

group_resolver_spec.rb « resolvers « graphql « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5eb9cd06d159e493a13231798d34bcf7ae40606b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 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(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 { 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