blob: e32a0669ac5f6d62201f1bda1ae6c2acea8e9eef (
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
RSpec.shared_examples 'a valid Direct Transfer GraphQL query' do
let(:graphql_log) do
GitlabSchema.execute(
query.to_s,
variables: query.variables
)
RequestStore.store[:graphql_logs].first
end
it 'has a valid query' do
parsed_query = GraphQL::Query.new(
GitlabSchema,
query.to_s,
variables: query.variables
)
result = GitlabSchema.static_validator.validate(parsed_query)
expect(result[:errors]).to be_empty
end
it 'does not use any deprecated GraphQL schema' do
expect(graphql_log.keys).to include(
:used_deprecated_fields,
:used_deprecated_arguments
)
expect(graphql_log[:used_deprecated_fields]).to be_empty
expect(graphql_log[:used_deprecated_arguments]).to be_empty
end
it 'does not exceed max authenticated complexity' do
expect(graphql_log).to have_key(:complexity)
expect(graphql_log[:complexity]).to be < GitlabSchema::AUTHENTICATED_MAX_COMPLEXITY
end
it 'does not exceed max depth' do
expect(graphql_log).to have_key(:depth)
expect(graphql_log[:depth]).to be < GitlabSchema::DEFAULT_MAX_DEPTH
end
end
|