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

query_complexity_type_spec.rb « types « graphql « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6b2330f2b13fef61efeaeb4b7348ffc3ca12002a (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe GitlabSchema.types['QueryComplexity'] do
  include GraphqlHelpers

  specify do
    expect(described_class).to have_graphql_fields(:limit, :score).only
  end

  it 'works when executed' do
    query = <<-GQL
      query {
        queryComplexity {
          score
          limit
        }

        currentUser {
          name
        }
      }
    GQL

    query_result = run_with_clean_state(query).to_h

    data = graphql_dig_at(query_result, :data, :queryComplexity)

    expect(data).to include(
      'score' => be > 0,
      'limit' => GitlabSchema::DEFAULT_MAX_COMPLEXITY
    )
  end
end