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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/graphql/types
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/graphql/types')
-rw-r--r--spec/graphql/types/base_argument_spec.rb38
-rw-r--r--spec/graphql/types/base_field_spec.rb32
-rw-r--r--spec/graphql/types/global_id_type_spec.rb4
-rw-r--r--spec/graphql/types/group_type_spec.rb11
-rw-r--r--spec/graphql/types/issue_type_spec.rb2
-rw-r--r--spec/graphql/types/merge_requests/reviewer_type_spec.rb2
-rw-r--r--spec/graphql/types/namespace_type_spec.rb2
-rw-r--r--spec/graphql/types/packages/nuget/dependency_link_metdatum_type_spec.rb13
-rw-r--r--spec/graphql/types/packages/package_dependency_link_type_spec.rb13
-rw-r--r--spec/graphql/types/packages/package_dependency_type_enum_spec.rb9
-rw-r--r--spec/graphql/types/packages/package_dependency_type_spec.rb13
-rw-r--r--spec/graphql/types/packages/package_details_type_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/base_permission_type_spec.rb2
-rw-r--r--spec/graphql/types/project_type_spec.rb11
-rw-r--r--spec/graphql/types/query_type_spec.rb11
-rw-r--r--spec/graphql/types/range_input_type_spec.rb6
-rw-r--r--spec/graphql/types/repository_type_spec.rb2
-rw-r--r--spec/graphql/types/timelog_type_spec.rb2
-rw-r--r--spec/graphql/types/user_type_spec.rb11
19 files changed, 152 insertions, 34 deletions
diff --git a/spec/graphql/types/base_argument_spec.rb b/spec/graphql/types/base_argument_spec.rb
index 61e0179ff21..8f5f2e08799 100644
--- a/spec/graphql/types/base_argument_spec.rb
+++ b/spec/graphql/types/base_argument_spec.rb
@@ -3,15 +3,41 @@
require 'spec_helper'
RSpec.describe Types::BaseArgument do
- include_examples 'Gitlab-style deprecations' do
- let_it_be(:field) do
- Types::BaseField.new(name: 'field', type: String, null: true)
+ let_it_be(:field) do
+ Types::BaseField.new(name: 'field', type: String, null: true)
+ end
+
+ let(:base_args) { { name: 'test', type: String, required: false, owner: field } }
+
+ def subject(args = {})
+ described_class.new(**base_args.merge(args))
+ end
+
+ include_examples 'Gitlab-style deprecations'
+
+ describe 'required argument declarations' do
+ it 'accepts nullable, required arguments' do
+ arguments = base_args.merge({ required: :nullable })
+
+ expect { subject(arguments) }.not_to raise_error
+ end
+
+ it 'accepts required, non-nullable arguments' do
+ arguments = base_args.merge({ required: true })
+
+ expect { subject(arguments) }.not_to raise_error
+ end
+
+ it 'accepts non-required arguments' do
+ arguments = base_args.merge({ required: false })
+
+ expect { subject(arguments) }.not_to raise_error
end
- let(:base_args) { { name: 'test', type: String, required: false, owner: field } }
+ it 'accepts no required argument declaration' do
+ arguments = base_args
- def subject(args = {})
- described_class.new(**base_args.merge(args))
+ expect { subject(arguments) }.not_to raise_error
end
end
end
diff --git a/spec/graphql/types/base_field_spec.rb b/spec/graphql/types/base_field_spec.rb
index c34fbf42dd8..82efd618e38 100644
--- a/spec/graphql/types/base_field_spec.rb
+++ b/spec/graphql/types/base_field_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe Types::BaseField do
end
it 'defaults to 1' do
- field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, null: true)
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true)
expect(field.to_graphql.complexity).to eq 1
end
@@ -25,7 +25,7 @@ RSpec.describe Types::BaseField do
describe '#base_complexity' do
context 'with no gitaly calls' do
it 'defaults to 1' do
- field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, null: true)
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true)
expect(field.base_complexity).to eq 1
end
@@ -33,7 +33,7 @@ RSpec.describe Types::BaseField do
context 'with a gitaly call' do
it 'adds 1 to the default value' do
- field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true)
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true, calls_gitaly: true)
expect(field.base_complexity).to eq 2
end
@@ -41,14 +41,14 @@ RSpec.describe Types::BaseField do
end
it 'has specified value' do
- field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, null: true, complexity: 12)
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true, complexity: 12)
expect(field.to_graphql.complexity).to eq 12
end
context 'when field has a resolver' do
context 'when a valid complexity is already set' do
- let(:field) { described_class.new(name: 'test', type: GraphQL::STRING_TYPE.connection_type, resolver_class: resolver, complexity: 2, max_page_size: 100, null: true) }
+ let(:field) { described_class.new(name: 'test', type: GraphQL::Types::String.connection_type, resolver_class: resolver, complexity: 2, max_page_size: 100, null: true) }
it 'uses this complexity' do
expect(field.to_graphql.complexity).to eq 2
@@ -56,7 +56,7 @@ RSpec.describe Types::BaseField do
end
context 'and is a connection' do
- let(:field) { described_class.new(name: 'test', type: GraphQL::STRING_TYPE.connection_type, resolver_class: resolver, max_page_size: 100, null: true) }
+ let(:field) { described_class.new(name: 'test', type: GraphQL::Types::String.connection_type, resolver_class: resolver, max_page_size: 100, null: true) }
it 'sets complexity depending on arguments for resolvers' do
expect(field.to_graphql.complexity.call({}, {}, 2)).to eq 4
@@ -71,7 +71,7 @@ RSpec.describe Types::BaseField do
context 'and is not a connection' do
it 'sets complexity as normal' do
- field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, resolver_class: resolver, max_page_size: 100, null: true)
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, resolver_class: resolver, max_page_size: 100, null: true)
expect(field.to_graphql.complexity.call({}, {}, 2)).to eq 2
expect(field.to_graphql.complexity.call({}, { first: 50 }, 2)).to eq 2
@@ -82,8 +82,8 @@ RSpec.describe Types::BaseField do
context 'calls_gitaly' do
context 'for fields with a resolver' do
it 'adds 1 if true' do
- with_gitaly_field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, resolver_class: resolver, null: true, calls_gitaly: true)
- without_gitaly_field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, resolver_class: resolver, null: true)
+ with_gitaly_field = described_class.new(name: 'test', type: GraphQL::Types::String, resolver_class: resolver, null: true, calls_gitaly: true)
+ without_gitaly_field = described_class.new(name: 'test', type: GraphQL::Types::String, resolver_class: resolver, null: true)
base_result = without_gitaly_field.to_graphql.complexity.call({}, {}, 2)
expect(with_gitaly_field.to_graphql.complexity.call({}, {}, 2)).to eq base_result + 1
@@ -92,28 +92,28 @@ RSpec.describe Types::BaseField do
context 'for fields without a resolver' do
it 'adds 1 if true' do
- field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true)
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true, calls_gitaly: true)
expect(field.to_graphql.complexity).to eq 2
end
end
it 'defaults to false' do
- field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, null: true)
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true)
expect(field.base_complexity).to eq Types::BaseField::DEFAULT_COMPLEXITY
end
context 'with declared constant complexity value' do
it 'has complexity set to that constant' do
- field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, null: true, complexity: 12)
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true, complexity: 12)
expect(field.to_graphql.complexity).to eq 12
end
it 'does not raise an error even with Gitaly calls' do
allow(Gitlab::GitalyClient).to receive(:get_request_count).and_return([0, 1])
- field = described_class.new(name: 'test', type: GraphQL::STRING_TYPE, null: true, complexity: 12)
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true, complexity: 12)
expect(field.to_graphql.complexity).to eq 12
end
@@ -123,7 +123,7 @@ RSpec.describe Types::BaseField do
describe '#visible?' do
context 'and has a feature_flag' do
let(:flag) { :test_feature }
- let(:field) { described_class.new(name: 'test', type: GraphQL::STRING_TYPE, feature_flag: flag, null: false) }
+ let(:field) { described_class.new(name: 'test', type: GraphQL::Types::String, feature_flag: flag, null: false) }
let(:context) { {} }
before do
@@ -156,7 +156,7 @@ RSpec.describe Types::BaseField do
describe '#description' do
context 'feature flag given' do
- let(:field) { described_class.new(name: 'test', type: GraphQL::STRING_TYPE, feature_flag: flag, null: false, description: 'Test description.') }
+ let(:field) { described_class.new(name: 'test', type: GraphQL::Types::String, feature_flag: flag, null: false, description: 'Test description.') }
let(:flag) { :test_flag }
it 'prepends the description' do
@@ -211,7 +211,7 @@ RSpec.describe Types::BaseField do
include_examples 'Gitlab-style deprecations' do
def subject(args = {})
- base_args = { name: 'test', type: GraphQL::STRING_TYPE, null: true }
+ base_args = { name: 'test', type: GraphQL::Types::String, null: true }
described_class.new(**base_args.merge(args))
end
diff --git a/spec/graphql/types/global_id_type_spec.rb b/spec/graphql/types/global_id_type_spec.rb
index cdf09dd9cc9..4efa3018dad 100644
--- a/spec/graphql/types/global_id_type_spec.rb
+++ b/spec/graphql/types/global_id_type_spec.rb
@@ -255,7 +255,7 @@ RSpec.describe Types::GlobalIDType do
query(GraphQL.parse(gql_query), vars).result
end
- all_types = [::GraphQL::ID_TYPE, ::Types::GlobalIDType, ::Types::GlobalIDType[::Project]]
+ all_types = [::GraphQL::Types::ID, ::Types::GlobalIDType, ::Types::GlobalIDType[::Project]]
shared_examples 'a working query' do
# Simplified schema to test compatibility
@@ -284,7 +284,7 @@ RSpec.describe Types::GlobalIDType do
# This is needed so that all types are always registered as input types
field :echo, String, null: true do
- argument :id, ::GraphQL::ID_TYPE, required: false
+ argument :id, ::GraphQL::Types::ID, required: false
argument :gid, ::Types::GlobalIDType, required: false
argument :pid, ::Types::GlobalIDType[::Project], required: false
end
diff --git a/spec/graphql/types/group_type_spec.rb b/spec/graphql/types/group_type_spec.rb
index ef11e3d309c..33250f8e6af 100644
--- a/spec/graphql/types/group_type_spec.rb
+++ b/spec/graphql/types/group_type_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe GitlabSchema.types['Group'] do
two_factor_grace_period auto_devops_enabled emails_disabled
mentions_disabled parent boards milestones group_members
merge_requests container_repositories container_repositories_count
- packages
+ packages shared_runners_setting timelogs
]
expect(described_class).to include_graphql_fields(*expected_fields)
@@ -39,6 +39,15 @@ RSpec.describe GitlabSchema.types['Group'] do
it { is_expected.to have_graphql_resolver(Resolvers::GroupMembersResolver) }
end
+ describe 'timelogs field' do
+ subject { described_class.fields['timelogs'] }
+
+ it 'finds timelogs between start time and end time' do
+ is_expected.to have_graphql_resolver(Resolvers::TimelogResolver)
+ is_expected.to have_non_null_graphql_type(Types::TimelogType.connection_type)
+ end
+ end
+
it_behaves_like 'a GraphQL type with labels' do
let(:labels_resolver_arguments) { [:search_term, :includeAncestorGroups, :includeDescendantGroups, :onlyGroupLabels] }
end
diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb
index a117741b3a2..b0aa11ee5ad 100644
--- a/spec/graphql/types/issue_type_spec.rb
+++ b/spec/graphql/types/issue_type_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe GitlabSchema.types['Issue'] do
it 'has specific fields' do
fields = %i[id iid title description state reference author assignees updated_by participants labels milestone due_date
- confidential discussion_locked upvotes downvotes user_notes_count user_discussions_count web_path web_url relative_position
+ confidential discussion_locked upvotes downvotes merge_requests_count user_notes_count user_discussions_count web_path web_url relative_position
emails_disabled subscribed time_estimate total_time_spent human_time_estimate human_total_time_spent closed_at created_at updated_at task_completion_status
design_collection alert_management_alert severity current_user_todos moved moved_to
create_note_email timelogs project_id]
diff --git a/spec/graphql/types/merge_requests/reviewer_type_spec.rb b/spec/graphql/types/merge_requests/reviewer_type_spec.rb
index c2182e9968c..4ede8e5788f 100644
--- a/spec/graphql/types/merge_requests/reviewer_type_spec.rb
+++ b/spec/graphql/types/merge_requests/reviewer_type_spec.rb
@@ -31,6 +31,8 @@ RSpec.describe GitlabSchema.types['MergeRequestReviewer'] do
starredProjects
callouts
merge_request_interaction
+ namespace
+ timelogs
]
expect(described_class).to have_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/namespace_type_spec.rb b/spec/graphql/types/namespace_type_spec.rb
index 2ed1ee3e8c4..3b7f7e65e4b 100644
--- a/spec/graphql/types/namespace_type_spec.rb
+++ b/spec/graphql/types/namespace_type_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe GitlabSchema.types['Namespace'] do
it 'has the expected fields' do
expected_fields = %w[
id name path full_name full_path description description_html visibility
- lfs_enabled request_access_enabled projects root_storage_statistics
+ lfs_enabled request_access_enabled projects root_storage_statistics shared_runners_setting
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/packages/nuget/dependency_link_metdatum_type_spec.rb b/spec/graphql/types/packages/nuget/dependency_link_metdatum_type_spec.rb
new file mode 100644
index 00000000000..b11d9d131aa
--- /dev/null
+++ b/spec/graphql/types/packages/nuget/dependency_link_metdatum_type_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['NugetDependencyLinkMetadata'] do
+ it 'includes nuget dependency link metadatum fields' do
+ expected_fields = %w[
+ id target_framework
+ ]
+
+ expect(described_class).to include_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/packages/package_dependency_link_type_spec.rb b/spec/graphql/types/packages/package_dependency_link_type_spec.rb
new file mode 100644
index 00000000000..53ee8be69a6
--- /dev/null
+++ b/spec/graphql/types/packages/package_dependency_link_type_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['PackageDependencyLink'] do
+ it 'includes package file fields' do
+ expected_fields = %w[
+ id dependency_type dependency metadata
+ ]
+
+ expect(described_class).to include_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/packages/package_dependency_type_enum_spec.rb b/spec/graphql/types/packages/package_dependency_type_enum_spec.rb
new file mode 100644
index 00000000000..b8893a3619e
--- /dev/null
+++ b/spec/graphql/types/packages/package_dependency_type_enum_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['PackageDependencyType'] do
+ it 'exposes all depeendency type values' do
+ expect(described_class.values.keys).to contain_exactly(*%w[DEPENDENCIES DEV_DEPENDENCIES BUNDLE_DEPENDENCIES PEER_DEPENDENCIES])
+ end
+end
diff --git a/spec/graphql/types/packages/package_dependency_type_spec.rb b/spec/graphql/types/packages/package_dependency_type_spec.rb
new file mode 100644
index 00000000000..67474729781
--- /dev/null
+++ b/spec/graphql/types/packages/package_dependency_type_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['PackageDependency'] do
+ it 'includes package file fields' do
+ expected_fields = %w[
+ id name version_pattern
+ ]
+
+ expect(described_class).to include_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/packages/package_details_type_spec.rb b/spec/graphql/types/packages/package_details_type_spec.rb
index 06093813315..7e1103d8aa0 100644
--- a/spec/graphql/types/packages/package_details_type_spec.rb
+++ b/spec/graphql/types/packages/package_details_type_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['PackageDetailsType'] do
it 'includes all the package fields' do
expected_fields = %w[
- id name version created_at updated_at package_type tags project pipelines versions package_files
+ id name version created_at updated_at package_type tags project pipelines versions package_files dependency_links
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/permission_types/base_permission_type_spec.rb b/spec/graphql/types/permission_types/base_permission_type_spec.rb
index 68632a509ee..e4726ad0e6e 100644
--- a/spec/graphql/types/permission_types/base_permission_type_spec.rb
+++ b/spec/graphql/types/permission_types/base_permission_type_spec.rb
@@ -36,7 +36,7 @@ RSpec.describe Types::PermissionTypes::BasePermissionType do
expected_keywords = {
name: :resolve_using_hash,
hash_key: :the_key,
- type: GraphQL::BOOLEAN_TYPE,
+ type: GraphQL::Types::Boolean,
description: "custom description",
null: false
}
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb
index a22110e8338..d825bd7ebd4 100644
--- a/spec/graphql/types/project_type_spec.rb
+++ b/spec/graphql/types/project_type_spec.rb
@@ -33,7 +33,7 @@ RSpec.describe GitlabSchema.types['Project'] do
issue_status_counts terraform_states alert_management_integrations
container_repositories container_repositories_count
pipeline_analytics squash_read_only sast_ci_configuration
- ci_template
+ ci_template timelogs
]
expect(described_class).to include_graphql_fields(*expected_fields)
@@ -392,6 +392,15 @@ RSpec.describe GitlabSchema.types['Project'] do
it { is_expected.to have_graphql_resolver(Resolvers::Terraform::StatesResolver) }
end
+ describe 'timelogs field' do
+ subject { described_class.fields['timelogs'] }
+
+ it 'finds timelogs for project' do
+ is_expected.to have_graphql_resolver(Resolvers::TimelogResolver)
+ is_expected.to have_graphql_type(Types::TimelogType.connection_type)
+ end
+ end
+
it_behaves_like 'a GraphQL type with labels' do
let(:labels_resolver_arguments) { [:search_term, :includeAncestorGroups] }
end
diff --git a/spec/graphql/types/query_type_spec.rb b/spec/graphql/types/query_type_spec.rb
index 9a8f2090cc1..6a43867f1fe 100644
--- a/spec/graphql/types/query_type_spec.rb
+++ b/spec/graphql/types/query_type_spec.rb
@@ -26,6 +26,7 @@ RSpec.describe GitlabSchema.types['Query'] do
runner_platforms
runner
runners
+ timelogs
]
expect(described_class).to have_graphql_fields(*expected_fields).at_least
@@ -125,4 +126,14 @@ RSpec.describe GitlabSchema.types['Query'] do
it { is_expected.to have_graphql_type(Types::Packages::PackageDetailsType) }
end
+
+ describe 'timelogs field' do
+ subject { described_class.fields['timelogs'] }
+
+ it 'returns timelogs' do
+ is_expected.to have_graphql_arguments(:startDate, :endDate, :startTime, :endTime, :username, :projectId, :groupId, :after, :before, :first, :last)
+ is_expected.to have_graphql_type(Types::TimelogType.connection_type)
+ is_expected.to have_graphql_resolver(Resolvers::TimelogResolver)
+ end
+ end
end
diff --git a/spec/graphql/types/range_input_type_spec.rb b/spec/graphql/types/range_input_type_spec.rb
index aa6fd72cf13..ca27527c2b5 100644
--- a/spec/graphql/types/range_input_type_spec.rb
+++ b/spec/graphql/types/range_input_type_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe ::Types::RangeInputType do
- let(:of_integer) { ::GraphQL::INT_TYPE }
+ let(:of_integer) { ::GraphQL::Types::Int }
context 'parameterized on Integer' do
let(:type) { described_class[of_integer] }
@@ -32,12 +32,12 @@ RSpec.describe ::Types::RangeInputType do
expect(instance).to be_a_kind_of(described_class)
expect(instance).to be_a_kind_of(described_class[of_integer])
- expect(instance).not_to be_a_kind_of(described_class[GraphQL::ID_TYPE])
+ expect(instance).not_to be_a_kind_of(described_class[GraphQL::Types::ID])
end
it 'follows expected subtyping relationships for classes' do
expect(described_class[of_integer]).to be < described_class
- expect(described_class[of_integer]).not_to be < described_class[GraphQL::ID_TYPE]
+ expect(described_class[of_integer]).not_to be < described_class[GraphQL::Types::ID]
expect(described_class[of_integer]).not_to be < described_class[of_integer, false]
end
end
diff --git a/spec/graphql/types/repository_type_spec.rb b/spec/graphql/types/repository_type_spec.rb
index ee0cc4361da..5488d78b720 100644
--- a/spec/graphql/types/repository_type_spec.rb
+++ b/spec/graphql/types/repository_type_spec.rb
@@ -11,6 +11,8 @@ RSpec.describe GitlabSchema.types['Repository'] do
specify { expect(described_class).to have_graphql_field(:tree) }
+ specify { expect(described_class).to have_graphql_field(:paginated_tree, calls_gitaly?: true, max_page_size: 100) }
+
specify { expect(described_class).to have_graphql_field(:exists, calls_gitaly?: true, complexity: 2) }
specify { expect(described_class).to have_graphql_field(:blobs) }
diff --git a/spec/graphql/types/timelog_type_spec.rb b/spec/graphql/types/timelog_type_spec.rb
index 1344af89fb6..dc1b1e2253e 100644
--- a/spec/graphql/types/timelog_type_spec.rb
+++ b/spec/graphql/types/timelog_type_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe GitlabSchema.types['Timelog'] do
- let(:fields) { %i[spent_at time_spent user issue merge_request note] }
+ let(:fields) { %i[spent_at time_spent user issue merge_request note summary] }
it { expect(described_class.graphql_name).to eq('Timelog') }
it { expect(described_class).to have_graphql_fields(fields) }
diff --git a/spec/graphql/types/user_type_spec.rb b/spec/graphql/types/user_type_spec.rb
index 7d73727b041..363ccdf88b7 100644
--- a/spec/graphql/types/user_type_spec.rb
+++ b/spec/graphql/types/user_type_spec.rb
@@ -36,6 +36,8 @@ RSpec.describe GitlabSchema.types['User'] do
projectMemberships
starredProjects
callouts
+ namespace
+ timelogs
]
expect(described_class).to have_graphql_fields(*expected_fields)
@@ -57,4 +59,13 @@ RSpec.describe GitlabSchema.types['User'] do
is_expected.to have_graphql_type(Types::UserCalloutType.connection_type)
end
end
+
+ describe 'timelogs field' do
+ subject { described_class.fields['timelogs'] }
+
+ it 'returns user timelogs' do
+ is_expected.to have_graphql_resolver(Resolvers::TimelogResolver)
+ is_expected.to have_graphql_type(Types::TimelogType.connection_type)
+ end
+ end
end