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

get_projects_query_spec.rb « graphql « groups « bulk_imports « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1a7c5a4993cc4c90a71cbc18ccc4a316259c4e71 (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
33
34
35
36
37
38
39
40
41
42
43
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe BulkImports::Groups::Graphql::GetProjectsQuery do
  describe '#variables' do
    it 'returns valid variables based on entity information' do
      tracker = create(:bulk_import_tracker)
      context = BulkImports::Pipeline::Context.new(tracker)

      query = GraphQL::Query.new(
        GitlabSchema,
        described_class.to_s,
        variables: described_class.variables(context)
      )
      result = GitlabSchema.static_validator.validate(query)

      expect(result[:errors]).to be_empty
    end

    context 'with invalid variables' do
      it 'raises an error' do
        expect { GraphQL::Query.new(GitlabSchema, described_class.to_s, variables: 'invalid') }.to raise_error(ArgumentError)
      end
    end
  end

  describe '#data_path' do
    it 'returns data path' do
      expected = %w[data group projects nodes]

      expect(described_class.data_path).to eq(expected)
    end
  end

  describe '#page_info_path' do
    it 'returns pagination information path' do
      expected = %w[data group projects page_info]

      expect(described_class.page_info_path).to eq(expected)
    end
  end
end