summaryrefslogtreecommitdiff
path: root/spec/graphql/types
diff options
context:
space:
mode:
Diffstat (limited to 'spec/graphql/types')
-rw-r--r--spec/graphql/types/ci/detailed_status_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/pipeline_type_spec.rb2
-rw-r--r--spec/graphql/types/commit_type_spec.rb7
-rw-r--r--spec/graphql/types/extended_issue_type_spec.rb21
-rw-r--r--spec/graphql/types/issue_type_spec.rb7
-rw-r--r--spec/graphql/types/merge_request_type_spec.rb6
-rw-r--r--spec/graphql/types/metadata_type_spec.rb2
-rw-r--r--spec/graphql/types/notes/diff_position_type_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/base_permission_type_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/issue_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/merge_request_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/merge_request_type_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/note_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/project_spec.rb2
-rw-r--r--spec/graphql/types/project_type_spec.rb38
-rw-r--r--spec/graphql/types/query_type_spec.rb4
-rw-r--r--spec/graphql/types/repository_type_spec.rb2
-rw-r--r--spec/graphql/types/time_type_spec.rb2
-rw-r--r--spec/graphql/types/todo_type_spec.rb13
19 files changed, 114 insertions, 6 deletions
diff --git a/spec/graphql/types/ci/detailed_status_type_spec.rb b/spec/graphql/types/ci/detailed_status_type_spec.rb
index a21162adb42..169a03c770b 100644
--- a/spec/graphql/types/ci/detailed_status_type_spec.rb
+++ b/spec/graphql/types/ci/detailed_status_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe Types::Ci::DetailedStatusType do
diff --git a/spec/graphql/types/ci/pipeline_type_spec.rb b/spec/graphql/types/ci/pipeline_type_spec.rb
index ec1c689a4be..2fafc1bc13f 100644
--- a/spec/graphql/types/ci/pipeline_type_spec.rb
+++ b/spec/graphql/types/ci/pipeline_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe Types::Ci::PipelineType do
diff --git a/spec/graphql/types/commit_type_spec.rb b/spec/graphql/types/commit_type_spec.rb
index 5d8edcf254c..1ff1c97f8db 100644
--- a/spec/graphql/types/commit_type_spec.rb
+++ b/spec/graphql/types/commit_type_spec.rb
@@ -7,5 +7,10 @@ describe GitlabSchema.types['Commit'] do
it { expect(described_class).to require_graphql_authorizations(:download_code) }
- it { expect(described_class).to have_graphql_fields(:id, :sha, :title, :description, :message, :authored_date, :author, :web_url, :latest_pipeline) }
+ it 'contains attributes related to commit' do
+ expect(described_class).to have_graphql_fields(
+ :id, :sha, :title, :description, :message, :authored_date,
+ :author, :web_url, :latest_pipeline, :signature_html
+ )
+ end
end
diff --git a/spec/graphql/types/extended_issue_type_spec.rb b/spec/graphql/types/extended_issue_type_spec.rb
new file mode 100644
index 00000000000..72ce53ae1be
--- /dev/null
+++ b/spec/graphql/types/extended_issue_type_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe GitlabSchema.types['ExtendedIssue'] do
+ it { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Issue) }
+
+ it { expect(described_class.graphql_name).to eq('ExtendedIssue') }
+
+ it { expect(described_class).to require_graphql_authorizations(:read_issue) }
+
+ it { expect(described_class.interfaces).to include(Types::Notes::NoteableType.to_graphql) }
+
+ it 'has specific fields' do
+ fields = Types::IssueType.fields.keys + [:subscribed]
+
+ fields.each do |field_name|
+ expect(described_class).to have_graphql_field(field_name)
+ end
+ end
+end
diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb
index 734e5af3cd8..8aa2385ddaa 100644
--- a/spec/graphql/types/issue_type_spec.rb
+++ b/spec/graphql/types/issue_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe GitlabSchema.types['Issue'] do
@@ -10,8 +12,9 @@ describe GitlabSchema.types['Issue'] do
it { expect(described_class.interfaces).to include(Types::Notes::NoteableType.to_graphql) }
it 'has specific fields' do
- fields = %i[title_html description_html relative_position web_path web_url
- reference]
+ fields = %i[iid title description state reference author assignees participants labels milestone due_date
+ confidential discussion_locked upvotes downvotes user_notes_count web_path web_url relative_position
+ time_estimate total_time_spent closed_at created_at updated_at task_completion_status]
fields.each do |field_name|
expect(described_class).to have_graphql_field(field_name)
diff --git a/spec/graphql/types/merge_request_type_spec.rb b/spec/graphql/types/merge_request_type_spec.rb
index 59bd0123d88..04e9bb6861f 100644
--- a/spec/graphql/types/merge_request_type_spec.rb
+++ b/spec/graphql/types/merge_request_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe GitlabSchema.types['MergeRequest'] do
@@ -18,7 +20,9 @@ describe GitlabSchema.types['MergeRequest'] do
merge_error allow_collaboration should_be_rebased rebase_commit_sha
rebase_in_progress merge_commit_message default_merge_commit_message
merge_ongoing source_branch_exists mergeable_discussions_state web_url
- upvotes downvotes subscribed head_pipeline pipelines task_completion_status
+ upvotes downvotes head_pipeline pipelines task_completion_status
+ milestone assignees participants subscribed labels discussion_locked time_estimate
+ total_time_spent reference
]
is_expected.to have_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/metadata_type_spec.rb b/spec/graphql/types/metadata_type_spec.rb
index 5236380e477..2988f3c6ba5 100644
--- a/spec/graphql/types/metadata_type_spec.rb
+++ b/spec/graphql/types/metadata_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe GitlabSchema.types['Metadata'] do
diff --git a/spec/graphql/types/notes/diff_position_type_spec.rb b/spec/graphql/types/notes/diff_position_type_spec.rb
index 345bca8f702..aa08daaacd4 100644
--- a/spec/graphql/types/notes/diff_position_type_spec.rb
+++ b/spec/graphql/types/notes/diff_position_type_spec.rb
@@ -7,6 +7,6 @@ describe GitlabSchema.types['DiffPosition'] do
:new_path, :position_type, :old_line, :new_line, :x, :y,
:width, :height]
- is_expected.to have_graphql_field(*expected_fields)
+ is_expected.to have_graphql_fields(*expected_fields)
end
end
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 0ee8b883d51..a45102e5b50 100644
--- a/spec/graphql/types/permission_types/base_permission_type_spec.rb
+++ b/spec/graphql/types/permission_types/base_permission_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe Types::PermissionTypes::BasePermissionType do
diff --git a/spec/graphql/types/permission_types/issue_spec.rb b/spec/graphql/types/permission_types/issue_spec.rb
index f0fbeda202f..a94bc6b780e 100644
--- a/spec/graphql/types/permission_types/issue_spec.rb
+++ b/spec/graphql/types/permission_types/issue_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe Types::PermissionTypes::Issue do
diff --git a/spec/graphql/types/permission_types/merge_request_spec.rb b/spec/graphql/types/permission_types/merge_request_spec.rb
index e1026b01a74..e0f8bdd4712 100644
--- a/spec/graphql/types/permission_types/merge_request_spec.rb
+++ b/spec/graphql/types/permission_types/merge_request_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe Types::PermissionTypes::MergeRequest do
diff --git a/spec/graphql/types/permission_types/merge_request_type_spec.rb b/spec/graphql/types/permission_types/merge_request_type_spec.rb
index 6e57122867a..572b4ac42d0 100644
--- a/spec/graphql/types/permission_types/merge_request_type_spec.rb
+++ b/spec/graphql/types/permission_types/merge_request_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe Types::MergeRequestType do
diff --git a/spec/graphql/types/permission_types/note_spec.rb b/spec/graphql/types/permission_types/note_spec.rb
index 32d56eb1f7a..a7811fc20e5 100644
--- a/spec/graphql/types/permission_types/note_spec.rb
+++ b/spec/graphql/types/permission_types/note_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe GitlabSchema.types['NotePermissions'] do
diff --git a/spec/graphql/types/permission_types/project_spec.rb b/spec/graphql/types/permission_types/project_spec.rb
index 4974995b587..6d5a905c128 100644
--- a/spec/graphql/types/permission_types/project_spec.rb
+++ b/spec/graphql/types/permission_types/project_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe Types::PermissionTypes::Project do
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb
index 69fbc72bdf5..cfd0f8ec7a7 100644
--- a/spec/graphql/types/project_type_spec.rb
+++ b/spec/graphql/types/project_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe GitlabSchema.types['Project'] do
@@ -25,4 +27,40 @@ describe GitlabSchema.types['Project'] do
is_expected.to have_graphql_fields(*expected_fields)
end
+
+ describe 'issue field' do
+ subject { described_class.fields['issue'] }
+
+ it 'returns issue' do
+ is_expected.to have_graphql_type(Types::ExtendedIssueType)
+ is_expected.to have_graphql_resolver(Resolvers::IssuesResolver.single)
+ end
+ end
+
+ describe 'issues field' do
+ subject { described_class.fields['issues'] }
+
+ it 'returns issue' do
+ is_expected.to have_graphql_type(Types::IssueType.connection_type)
+ is_expected.to have_graphql_resolver(Resolvers::IssuesResolver)
+ end
+ end
+
+ describe 'merge_requests field' do
+ subject { described_class.fields['mergeRequest'] }
+
+ it 'returns merge requests' do
+ is_expected.to have_graphql_type(Types::MergeRequestType)
+ is_expected.to have_graphql_resolver(Resolvers::MergeRequestsResolver.single)
+ end
+ end
+
+ describe 'merge_request field' do
+ subject { described_class.fields['mergeRequests'] }
+
+ it 'returns merge request' do
+ is_expected.to have_graphql_type(Types::MergeRequestType.connection_type)
+ is_expected.to have_graphql_resolver(Resolvers::MergeRequestsResolver)
+ end
+ end
end
diff --git a/spec/graphql/types/query_type_spec.rb b/spec/graphql/types/query_type_spec.rb
index bc3b8a42392..1365bc0dc14 100644
--- a/spec/graphql/types/query_type_spec.rb
+++ b/spec/graphql/types/query_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe GitlabSchema.types['Query'] do
@@ -5,7 +7,7 @@ describe GitlabSchema.types['Query'] do
expect(described_class.graphql_name).to eq('Query')
end
- it { is_expected.to have_graphql_fields(:project, :namespace, :group, :echo, :metadata) }
+ it { is_expected.to have_graphql_fields(:project, :namespace, :group, :echo, :metadata, :current_user) }
describe 'namespace field' do
subject { described_class.fields['namespace'] }
diff --git a/spec/graphql/types/repository_type_spec.rb b/spec/graphql/types/repository_type_spec.rb
index 8a8238f2a2a..236f9bb9459 100644
--- a/spec/graphql/types/repository_type_spec.rb
+++ b/spec/graphql/types/repository_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe GitlabSchema.types['Repository'] do
diff --git a/spec/graphql/types/time_type_spec.rb b/spec/graphql/types/time_type_spec.rb
index 4196d9d27d4..88a535ed3bb 100644
--- a/spec/graphql/types/time_type_spec.rb
+++ b/spec/graphql/types/time_type_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe GitlabSchema.types['Time'] do
diff --git a/spec/graphql/types/todo_type_spec.rb b/spec/graphql/types/todo_type_spec.rb
new file mode 100644
index 00000000000..a5ea5bcffb0
--- /dev/null
+++ b/spec/graphql/types/todo_type_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe GitlabSchema.types['Todo'] do
+ it 'has the correct fields' do
+ expected_fields = [:id, :project, :group, :author, :action, :target_type, :body, :state, :created_at]
+
+ is_expected.to have_graphql_fields(*expected_fields)
+ end
+
+ it { expect(described_class).to require_graphql_authorizations(:read_todo) }
+end