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>2023-11-14 11:41:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-11-14 11:41:52 +0300
commit585826cb22ecea5998a2c2a4675735c94bdeedac (patch)
tree5b05f0b30d33cef48963609e8a18a4dff260eab3 /spec/graphql/types
parentdf221d036e5d0c6c0ee4d55b9c97f481ee05dee8 (diff)
Add latest changes from gitlab-org/gitlab@16-6-stable-eev16.6.0-rc42
Diffstat (limited to 'spec/graphql/types')
-rw-r--r--spec/graphql/types/analytics/cycle_analytics/value_stream_type_spec.rb11
-rw-r--r--spec/graphql/types/base_argument_spec.rb39
-rw-r--r--spec/graphql/types/ci/catalog/resource_sort_enum_spec.rb13
-rw-r--r--spec/graphql/types/ci/catalog/resource_type_spec.rb28
-rw-r--r--spec/graphql/types/container_registry/protection/rule_access_level_enum_spec.rb9
-rw-r--r--spec/graphql/types/container_registry/protection/rule_type_spec.rb35
-rw-r--r--spec/graphql/types/data_transfer/project_data_transfer_type_spec.rb22
-rw-r--r--spec/graphql/types/merge_request_review_state_enum_spec.rb8
-rw-r--r--spec/graphql/types/notes/noteable_interface_spec.rb1
-rw-r--r--spec/graphql/types/organizations/organization_type_spec.rb2
-rw-r--r--spec/graphql/types/organizations/organization_user_badge_type_spec.rb10
-rw-r--r--spec/graphql/types/packages/package_base_type_spec.rb3
-rw-r--r--spec/graphql/types/packages/package_details_type_spec.rb6
-rw-r--r--spec/graphql/types/packages/package_type_spec.rb5
-rw-r--r--spec/graphql/types/packages/protection/rule_type_spec.rb6
-rw-r--r--spec/graphql/types/packages/pypi/metadatum_type_spec.rb9
-rw-r--r--spec/graphql/types/permission_types/abuse_report_spec.rb15
-rw-r--r--spec/graphql/types/permission_types/ci/job_spec.rb2
-rw-r--r--spec/graphql/types/permission_types/ci/pipeline_spec.rb13
-rw-r--r--spec/graphql/types/permission_types/package_spec.rb11
-rw-r--r--spec/graphql/types/project_type_spec.rb91
-rw-r--r--spec/graphql/types/projects/detailed_import_status_type_spec.rb23
-rw-r--r--spec/graphql/types/security/codequality_reports_comparer/report_generation_status_enum_spec.rb11
-rw-r--r--spec/graphql/types/security/codequality_reports_comparer/status_enum_spec.rb4
-rw-r--r--spec/graphql/types/security/codequality_reports_comparer_type_spec.rb2
-rw-r--r--spec/graphql/types/user_type_spec.rb1
-rw-r--r--spec/graphql/types/work_items/linked_item_type_spec.rb6
27 files changed, 322 insertions, 64 deletions
diff --git a/spec/graphql/types/analytics/cycle_analytics/value_stream_type_spec.rb b/spec/graphql/types/analytics/cycle_analytics/value_stream_type_spec.rb
new file mode 100644
index 00000000000..5e2638210d3
--- /dev/null
+++ b/spec/graphql/types/analytics/cycle_analytics/value_stream_type_spec.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::Analytics::CycleAnalytics::ValueStreamType, feature_category: :value_stream_management do
+ specify { expect(described_class.graphql_name).to eq('ValueStream') }
+
+ specify { expect(described_class).to require_graphql_authorizations(:read_cycle_analytics) }
+
+ specify { expect(described_class).to have_graphql_fields(:id, :name, :namespace, :project) }
+end
diff --git a/spec/graphql/types/base_argument_spec.rb b/spec/graphql/types/base_argument_spec.rb
index 0ce6aa3667d..99154c8c9a5 100644
--- a/spec/graphql/types/base_argument_spec.rb
+++ b/spec/graphql/types/base_argument_spec.rb
@@ -3,41 +3,14 @@
require 'spec_helper'
RSpec.describe Types::BaseArgument, feature_category: :api do
- 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
+ include_examples 'Gitlab-style deprecations' do
+ let_it_be(:field) do
+ Types::BaseField.new(name: 'field', type: String, null: true)
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
-
- it 'accepts no required argument declaration' do
- arguments = base_args
-
- expect { subject(arguments) }.not_to raise_error
+ def subject(args = {})
+ base_args = { name: 'test', type: String, required: false, owner: field }
+ described_class.new(**base_args.merge(args))
end
end
end
diff --git a/spec/graphql/types/ci/catalog/resource_sort_enum_spec.rb b/spec/graphql/types/ci/catalog/resource_sort_enum_spec.rb
new file mode 100644
index 00000000000..1de324b6652
--- /dev/null
+++ b/spec/graphql/types/ci/catalog/resource_sort_enum_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['CiCatalogResourceSort'], feature_category: :pipeline_composition do
+ it { expect(described_class.graphql_name).to eq('CiCatalogResourceSort') }
+
+ it 'exposes all the existing catalog resource sort orders' do
+ expect(described_class.values.keys).to include(
+ *%w[NAME_ASC NAME_DESC LATEST_RELEASED_AT_ASC LATEST_RELEASED_AT_DESC CREATED_ASC CREATED_DESC]
+ )
+ end
+end
diff --git a/spec/graphql/types/ci/catalog/resource_type_spec.rb b/spec/graphql/types/ci/catalog/resource_type_spec.rb
new file mode 100644
index 00000000000..5f5732c5237
--- /dev/null
+++ b/spec/graphql/types/ci/catalog/resource_type_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::Ci::Catalog::ResourceType, feature_category: :pipeline_composition do
+ specify { expect(described_class.graphql_name).to eq('CiCatalogResource') }
+
+ it 'exposes the expected fields' do
+ expected_fields = %i[
+ id
+ name
+ description
+ icon
+ web_path
+ versions
+ latest_version
+ latest_released_at
+ star_count
+ forks_count
+ root_namespace
+ readme_html
+ open_issues_count
+ open_merge_requests_count
+ ]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/container_registry/protection/rule_access_level_enum_spec.rb b/spec/graphql/types/container_registry/protection/rule_access_level_enum_spec.rb
new file mode 100644
index 00000000000..295401f89f9
--- /dev/null
+++ b/spec/graphql/types/container_registry/protection/rule_access_level_enum_spec.rb
@@ -0,0 +1,9 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['ContainerRegistryProtectionRuleAccessLevel'], feature_category: :container_registry do
+ it 'exposes all options' do
+ expect(described_class.values.keys).to match_array(%w[DEVELOPER MAINTAINER OWNER])
+ end
+end
diff --git a/spec/graphql/types/container_registry/protection/rule_type_spec.rb b/spec/graphql/types/container_registry/protection/rule_type_spec.rb
new file mode 100644
index 00000000000..58b53af80fb
--- /dev/null
+++ b/spec/graphql/types/container_registry/protection/rule_type_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['ContainerRegistryProtectionRule'], feature_category: :container_registry do
+ specify { expect(described_class.graphql_name).to eq('ContainerRegistryProtectionRule') }
+
+ specify { expect(described_class.description).to be_present }
+
+ specify { expect(described_class).to require_graphql_authorizations(:admin_container_image) }
+
+ describe 'id' do
+ subject { described_class.fields['id'] }
+
+ it { is_expected.to have_non_null_graphql_type(::Types::GlobalIDType[::ContainerRegistry::Protection::Rule]) }
+ end
+
+ describe 'container_path_pattern' do
+ subject { described_class.fields['containerPathPattern'] }
+
+ it { is_expected.to have_non_null_graphql_type(GraphQL::Types::String) }
+ end
+
+ describe 'push_protected_up_to_access_level' do
+ subject { described_class.fields['pushProtectedUpToAccessLevel'] }
+
+ it { is_expected.to have_non_null_graphql_type(Types::ContainerRegistry::Protection::RuleAccessLevelEnum) }
+ end
+
+ describe 'delete_protected_up_to_access_level' do
+ subject { described_class.fields['deleteProtectedUpToAccessLevel'] }
+
+ it { is_expected.to have_non_null_graphql_type(Types::ContainerRegistry::Protection::RuleAccessLevelEnum) }
+ end
+end
diff --git a/spec/graphql/types/data_transfer/project_data_transfer_type_spec.rb b/spec/graphql/types/data_transfer/project_data_transfer_type_spec.rb
index a93da279b7f..80ead81650e 100644
--- a/spec/graphql/types/data_transfer/project_data_transfer_type_spec.rb
+++ b/spec/graphql/types/data_transfer/project_data_transfer_type_spec.rb
@@ -14,25 +14,15 @@ RSpec.describe GitlabSchema.types['ProjectDataTransfer'], feature_category: :sou
let_it_be(:project) { create(:project) }
let(:from) { Date.new(2022, 1, 1) }
let(:to) { Date.new(2023, 1, 1) }
- let(:finder_result) { 40_000_000 }
+ let(:relation) { instance_double(ActiveRecord::Relation) }
- it 'returns mock data' do
- expect(resolve_field(:total_egress, { from: from, to: to }, extras: { parent: project },
- arg_style: :internal)).to eq(finder_result)
+ before do
+ allow(relation).to receive(:sum).and_return(10)
end
- context 'when data_transfer_monitoring_mock_data is disabled' do
- let(:relation) { instance_double(ActiveRecord::Relation) }
-
- before do
- allow(relation).to receive(:sum).and_return(10)
- stub_feature_flags(data_transfer_monitoring_mock_data: false)
- end
-
- it 'calls sum on active record relation' do
- expect(resolve_field(:total_egress, { egress_nodes: relation }, extras: { parent: project },
- arg_style: :internal)).to eq(10)
- end
+ it 'calls sum on active record relation' do
+ expect(resolve_field(:total_egress, { egress_nodes: relation }, extras: { parent: project },
+ arg_style: :internal)).to eq(10)
end
end
end
diff --git a/spec/graphql/types/merge_request_review_state_enum_spec.rb b/spec/graphql/types/merge_request_review_state_enum_spec.rb
index 486e1c4f502..d8de3fcd1d1 100644
--- a/spec/graphql/types/merge_request_review_state_enum_spec.rb
+++ b/spec/graphql/types/merge_request_review_state_enum_spec.rb
@@ -6,12 +6,16 @@ RSpec.describe GitlabSchema.types['MergeRequestReviewState'] do
it 'the correct enum members' do
expect(described_class.values).to match(
'REVIEWED' => have_attributes(
- description: 'The merge request is reviewed.',
+ description: 'Merge request reviewer has reviewed.',
value: 'reviewed'
),
'UNREVIEWED' => have_attributes(
- description: 'The merge request is unreviewed.',
+ description: 'Awaiting review from merge request reviewer.',
value: 'unreviewed'
+ ),
+ 'REQUESTED_CHANGES' => have_attributes(
+ description: 'Merge request reviewer has requested changes.',
+ value: 'requested_changes'
)
)
end
diff --git a/spec/graphql/types/notes/noteable_interface_spec.rb b/spec/graphql/types/notes/noteable_interface_spec.rb
index e11dece60b8..c88cfe18b81 100644
--- a/spec/graphql/types/notes/noteable_interface_spec.rb
+++ b/spec/graphql/types/notes/noteable_interface_spec.rb
@@ -19,6 +19,7 @@ RSpec.describe Types::Notes::NoteableInterface do
expect(described_class.resolve_type(build(:merge_request), {})).to eq(Types::MergeRequestType)
expect(described_class.resolve_type(build(:design), {})).to eq(Types::DesignManagement::DesignType)
expect(described_class.resolve_type(build(:alert_management_alert), {})).to eq(Types::AlertManagement::AlertType)
+ expect(described_class.resolve_type(build(:abuse_report), {})).to eq(Types::AbuseReportType)
end
end
end
diff --git a/spec/graphql/types/organizations/organization_type_spec.rb b/spec/graphql/types/organizations/organization_type_spec.rb
index 26d7c10a715..62787ad220d 100644
--- a/spec/graphql/types/organizations/organization_type_spec.rb
+++ b/spec/graphql/types/organizations/organization_type_spec.rb
@@ -3,7 +3,7 @@
require 'spec_helper'
RSpec.describe GitlabSchema.types['Organization'], feature_category: :cell do
- let(:expected_fields) { %w[groups id name organization_users path] }
+ let(:expected_fields) { %w[groups id name organization_users path web_url] }
specify { expect(described_class.graphql_name).to eq('Organization') }
specify { expect(described_class).to require_graphql_authorizations(:read_organization) }
diff --git a/spec/graphql/types/organizations/organization_user_badge_type_spec.rb b/spec/graphql/types/organizations/organization_user_badge_type_spec.rb
new file mode 100644
index 00000000000..1ea9b3ad1df
--- /dev/null
+++ b/spec/graphql/types/organizations/organization_user_badge_type_spec.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['OrganizationUserBadge'], feature_category: :cell do
+ let(:expected_fields) { %w[text variant] }
+
+ specify { expect(described_class.graphql_name).to eq('OrganizationUserBadge') }
+ specify { expect(described_class).to have_graphql_fields(*expected_fields) }
+end
diff --git a/spec/graphql/types/packages/package_base_type_spec.rb b/spec/graphql/types/packages/package_base_type_spec.rb
index ebe29da0539..6b568f4ae7f 100644
--- a/spec/graphql/types/packages/package_base_type_spec.rb
+++ b/spec/graphql/types/packages/package_base_type_spec.rb
@@ -4,8 +4,8 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['PackageBase'], feature_category: :package_registry do
specify { expect(described_class.description).to eq('Represents a package in the Package Registry') }
-
specify { expect(described_class).to require_graphql_authorizations(:read_package) }
+ specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Package) }
it 'includes all expected fields' do
expected_fields = %w[
@@ -14,6 +14,7 @@ RSpec.describe GitlabSchema.types['PackageBase'], feature_category: :package_reg
project
tags metadata
status status_message can_destroy
+ user_permissions
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/packages/package_details_type_spec.rb b/spec/graphql/types/packages/package_details_type_spec.rb
index e4fe53f7660..464e81c0a8c 100644
--- a/spec/graphql/types/packages/package_details_type_spec.rb
+++ b/spec/graphql/types/packages/package_details_type_spec.rb
@@ -2,17 +2,17 @@
require 'spec_helper'
-RSpec.describe GitlabSchema.types['PackageDetailsType'] do
+RSpec.describe GitlabSchema.types['PackageDetailsType'], feature_category: :package_registry do
specify { expect(described_class.description).to eq('Represents a package details in the Package Registry') }
-
specify { expect(described_class).to require_graphql_authorizations(:read_package) }
+ specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Package) }
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 dependency_links public_package
npm_url maven_url conan_url nuget_url pypi_url pypi_setup_url
- composer_url composer_config_repository_url
+ composer_url composer_config_repository_url user_permissions
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/packages/package_type_spec.rb b/spec/graphql/types/packages/package_type_spec.rb
index df8135ed87e..dc1cc6a8bad 100644
--- a/spec/graphql/types/packages/package_type_spec.rb
+++ b/spec/graphql/types/packages/package_type_spec.rb
@@ -2,10 +2,10 @@
require 'spec_helper'
-RSpec.describe GitlabSchema.types['Package'] do
+RSpec.describe GitlabSchema.types['Package'], feature_category: :package_registry do
specify { expect(described_class.description).to eq('Represents a package with pipelines in the Package Registry') }
-
specify { expect(described_class).to require_graphql_authorizations(:read_package) }
+ specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::Package) }
it 'includes all the package fields and pipelines' do
expected_fields = %w[
@@ -14,6 +14,7 @@ RSpec.describe GitlabSchema.types['Package'] do
project
tags pipelines metadata
status can_destroy
+ user_permissions
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/packages/protection/rule_type_spec.rb b/spec/graphql/types/packages/protection/rule_type_spec.rb
index a4a458d3568..bc5a052796d 100644
--- a/spec/graphql/types/packages/protection/rule_type_spec.rb
+++ b/spec/graphql/types/packages/protection/rule_type_spec.rb
@@ -9,6 +9,12 @@ RSpec.describe GitlabSchema.types['PackagesProtectionRule'], feature_category: :
specify { expect(described_class).to require_graphql_authorizations(:admin_package) }
+ describe 'id' do
+ subject { described_class.fields['id'] }
+
+ it { is_expected.to have_non_null_graphql_type(::Types::GlobalIDType[::Packages::Protection::Rule]) }
+ end
+
describe 'package_name_pattern' do
subject { described_class.fields['packageNamePattern'] }
diff --git a/spec/graphql/types/packages/pypi/metadatum_type_spec.rb b/spec/graphql/types/packages/pypi/metadatum_type_spec.rb
index 16fb3ef2098..831307490a9 100644
--- a/spec/graphql/types/packages/pypi/metadatum_type_spec.rb
+++ b/spec/graphql/types/packages/pypi/metadatum_type_spec.rb
@@ -5,7 +5,14 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['PypiMetadata'] do
it 'includes pypi metadatum fields' do
expected_fields = %w[
- id required_python
+ author_email
+ description
+ description_content_type
+ id
+ keywords
+ metadata_version
+ required_python
+ summary
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/permission_types/abuse_report_spec.rb b/spec/graphql/types/permission_types/abuse_report_spec.rb
new file mode 100644
index 00000000000..399df137a78
--- /dev/null
+++ b/spec/graphql/types/permission_types/abuse_report_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::PermissionTypes::AbuseReport, feature_category: :insider_threat do
+ it do
+ expected_permissions = [
+ :read_abuse_report, :create_note
+ ]
+
+ expected_permissions.each do |permission|
+ expect(described_class).to have_graphql_field(permission)
+ end
+ end
+end
diff --git a/spec/graphql/types/permission_types/ci/job_spec.rb b/spec/graphql/types/permission_types/ci/job_spec.rb
index e4bc5419070..238f086c7ee 100644
--- a/spec/graphql/types/permission_types/ci/job_spec.rb
+++ b/spec/graphql/types/permission_types/ci/job_spec.rb
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe Types::PermissionTypes::Ci::Job do
it 'has expected permission fields' do
expected_permissions = [
- :read_job_artifacts, :read_build, :update_build
+ :read_job_artifacts, :read_build, :update_build, :cancel_build
]
expect(described_class).to have_graphql_fields(expected_permissions).only
diff --git a/spec/graphql/types/permission_types/ci/pipeline_spec.rb b/spec/graphql/types/permission_types/ci/pipeline_spec.rb
new file mode 100644
index 00000000000..6830b659b12
--- /dev/null
+++ b/spec/graphql/types/permission_types/ci/pipeline_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::PermissionTypes::Ci::Pipeline, feature_category: :continuous_integration do
+ it 'has expected permission fields' do
+ expected_permissions = [
+ :admin_pipeline, :destroy_pipeline, :update_pipeline, :cancel_pipeline
+ ]
+
+ expect(described_class).to have_graphql_fields(expected_permissions).only
+ end
+end
diff --git a/spec/graphql/types/permission_types/package_spec.rb b/spec/graphql/types/permission_types/package_spec.rb
new file mode 100644
index 00000000000..3de37438234
--- /dev/null
+++ b/spec/graphql/types/permission_types/package_spec.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['PackagePermissions'], feature_category: :package_registry do
+ it 'has the expected fields' do
+ expected_permissions = [:destroy_package]
+
+ expect(described_class).to have_graphql_fields(expected_permissions).only
+ end
+end
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb
index e295014a2a6..7b4bcf4b1b0 100644
--- a/spec/graphql/types/project_type_spec.rb
+++ b/spec/graphql/types/project_type_spec.rb
@@ -39,7 +39,7 @@ RSpec.describe GitlabSchema.types['Project'] do
recent_issue_boards ci_config_path_or_default packages_cleanup_policy ci_variables
timelog_categories fork_targets branch_rules ci_config_variables pipeline_schedules languages
incident_management_timeline_event_tags visible_forks inherited_ci_variables autocomplete_users
- ci_cd_settings
+ ci_cd_settings detailed_import_status
]
expect(described_class).to include_graphql_fields(*expected_fields)
@@ -932,4 +932,93 @@ RSpec.describe GitlabSchema.types['Project'] do
end
end
end
+
+ describe 'detailed_import_status' do
+ let_it_be_with_reload(:project) { create(:project, :with_import_url) }
+
+ let(:query) do
+ %(
+ query {
+ project(fullPath: "#{project.full_path}") {
+ detailedImportStatus {
+ status
+ url
+ lastError
+ }
+ }
+ }
+ )
+ end
+
+ subject { GitlabSchema.execute(query, context: { current_user: current_user }).as_json }
+
+ let(:detailed_import_status) do
+ subject.dig('data', 'project', 'detailedImportStatus')
+ end
+
+ context 'when project is not imported' do
+ let(:current_user) { create(:user) }
+
+ before do
+ project.add_developer(current_user)
+ project.import_state.destroy!
+ end
+
+ it 'returns nil' do
+ expect(detailed_import_status).to be_nil
+ end
+ end
+
+ context 'when current_user is not set' do
+ let(:current_user) { nil }
+
+ it 'returns nil' do
+ expect(detailed_import_status).to be_nil
+ end
+ end
+
+ context 'when current_user has no permission' do
+ let(:current_user) { create(:user) }
+
+ it 'returns nil' do
+ expect(detailed_import_status).to be_nil
+ end
+ end
+
+ context 'when current_user has limited permission' do
+ let(:current_user) { create(:user) }
+
+ before do
+ project.add_developer(current_user)
+ project.import_state.last_error = 'Some error'
+ project.import_state.save!
+ end
+
+ it 'returns detailed information' do
+ expect(detailed_import_status).to include(
+ 'status' => project.import_state.status,
+ 'url' => project.safe_import_url,
+ 'lastError' => nil
+ )
+ end
+ end
+
+ context 'when current_user has permission' do
+ let(:current_user) { create(:user) }
+
+ before do
+ project.add_maintainer(current_user)
+ project.import_state.last_error = 'Some error'
+ project.import_state.save!
+ end
+
+ it 'returns detailed information' do
+ expect(detailed_import_status).to include(
+ 'status' => project.import_state.status,
+ 'url' => project.safe_import_url,
+ 'lastError' => 'Some error'
+ )
+ end
+ end
+ end
end
diff --git a/spec/graphql/types/projects/detailed_import_status_type_spec.rb b/spec/graphql/types/projects/detailed_import_status_type_spec.rb
new file mode 100644
index 00000000000..cfdf06e4ab5
--- /dev/null
+++ b/spec/graphql/types/projects/detailed_import_status_type_spec.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['DetailedImportStatus'], feature_category: :importers do
+ include GraphqlHelpers
+
+ let(:fields) do
+ %w[
+ id
+ status
+ url
+ last_error
+ last_update_at
+ last_update_started_at
+ last_successful_update_at
+ ]
+ end
+
+ it { expect(described_class.graphql_name).to eq('DetailedImportStatus') }
+ it { expect(described_class).to have_graphql_fields(fields) }
+ it { expect(described_class).to require_graphql_authorizations(:read_project) }
+end
diff --git a/spec/graphql/types/security/codequality_reports_comparer/report_generation_status_enum_spec.rb b/spec/graphql/types/security/codequality_reports_comparer/report_generation_status_enum_spec.rb
new file mode 100644
index 00000000000..16a115c37e0
--- /dev/null
+++ b/spec/graphql/types/security/codequality_reports_comparer/report_generation_status_enum_spec.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['CodequalityReportsComparerReportGenerationStatus'], feature_category: :code_quality do
+ specify { expect(described_class.graphql_name).to eq('CodequalityReportsComparerReportGenerationStatus') }
+
+ it 'exposes all codequality report status values' do
+ expect(described_class.values.keys).to contain_exactly('PARSED', 'PARSING', 'ERROR')
+ end
+end
diff --git a/spec/graphql/types/security/codequality_reports_comparer/status_enum_spec.rb b/spec/graphql/types/security/codequality_reports_comparer/status_enum_spec.rb
index 6e5bdd1e91d..626873deffe 100644
--- a/spec/graphql/types/security/codequality_reports_comparer/status_enum_spec.rb
+++ b/spec/graphql/types/security/codequality_reports_comparer/status_enum_spec.rb
@@ -2,8 +2,8 @@
require 'spec_helper'
-RSpec.describe GitlabSchema.types['CodequalityReportsComparerReportStatus'], feature_category: :code_quality do
- specify { expect(described_class.graphql_name).to eq('CodequalityReportsComparerReportStatus') }
+RSpec.describe GitlabSchema.types['CodequalityReportsComparerStatus'], feature_category: :code_quality do
+ specify { expect(described_class.graphql_name).to eq('CodequalityReportsComparerStatus') }
it 'exposes all codequality report status values' do
expect(described_class.values.keys).to contain_exactly('SUCCESS', 'FAILED', 'NOT_FOUND')
diff --git a/spec/graphql/types/security/codequality_reports_comparer_type_spec.rb b/spec/graphql/types/security/codequality_reports_comparer_type_spec.rb
index 02f7a9d6925..fad43845b58 100644
--- a/spec/graphql/types/security/codequality_reports_comparer_type_spec.rb
+++ b/spec/graphql/types/security/codequality_reports_comparer_type_spec.rb
@@ -6,6 +6,6 @@ RSpec.describe GitlabSchema.types['CodequalityReportsComparer'], feature_categor
specify { expect(described_class.graphql_name).to eq('CodequalityReportsComparer') }
it 'has expected fields' do
- expect(described_class).to have_graphql_fields(:report)
+ expect(described_class).to have_graphql_fields(:status, :report)
end
end
diff --git a/spec/graphql/types/user_type_spec.rb b/spec/graphql/types/user_type_spec.rb
index af0f8a86b6c..457127f5bed 100644
--- a/spec/graphql/types/user_type_spec.rb
+++ b/spec/graphql/types/user_type_spec.rb
@@ -55,6 +55,7 @@ RSpec.describe GitlabSchema.types['User'], feature_category: :user_profile do
organization
jobTitle
createdAt
+ lastActivityOn
pronouns
ide
]
diff --git a/spec/graphql/types/work_items/linked_item_type_spec.rb b/spec/graphql/types/work_items/linked_item_type_spec.rb
index 7d7fda45ce4..8dc8a742790 100644
--- a/spec/graphql/types/work_items/linked_item_type_spec.rb
+++ b/spec/graphql/types/work_items/linked_item_type_spec.rb
@@ -10,4 +10,10 @@ RSpec.describe Types::WorkItems::LinkedItemType, feature_category: :portfolio_ma
expect(described_class).to have_graphql_fields(*expected_fields)
end
+
+ describe 'work_item' do
+ subject { described_class.fields['workItem'] }
+
+ it { is_expected.to have_nullable_graphql_type(Types::WorkItemType) }
+ end
end