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>2022-06-20 14:10:13 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-20 14:10:13 +0300
commit0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch)
tree7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /spec/graphql/types
parent72123183a20411a36d607d70b12d57c484394c8e (diff)
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'spec/graphql/types')
-rw-r--r--spec/graphql/types/base_edge_spec.rb1
-rw-r--r--spec/graphql/types/base_field_spec.rb86
-rw-r--r--spec/graphql/types/base_object_spec.rb1
-rw-r--r--spec/graphql/types/ci/detailed_status_type_spec.rb6
-rw-r--r--spec/graphql/types/ci/pipeline_merge_request_event_type_enum_spec.rb14
-rw-r--r--spec/graphql/types/ci/pipeline_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/runner_type_spec.rb2
-rw-r--r--spec/graphql/types/ci/status_action_type_spec.rb8
-rw-r--r--spec/graphql/types/issue_type_spec.rb10
-rw-r--r--spec/graphql/types/limited_countable_connection_type_spec.rb11
-rw-r--r--spec/graphql/types/packages/cleanup/keep_duplicated_package_files_enum_spec.rb15
-rw-r--r--spec/graphql/types/packages/cleanup/policy_type_spec.rb26
-rw-r--r--spec/graphql/types/project_type_spec.rb36
-rw-r--r--spec/graphql/types/terraform/state_type_spec.rb3
-rw-r--r--spec/graphql/types/time_type_spec.rb5
-rw-r--r--spec/graphql/types/todo_type_spec.rb14
-rw-r--r--spec/graphql/types/user_type_spec.rb8
-rw-r--r--spec/graphql/types/work_item_type_spec.rb13
-rw-r--r--spec/graphql/types/work_items/widget_interface_spec.rb37
-rw-r--r--spec/graphql/types/work_items/widget_type_enum_spec.rb13
-rw-r--r--spec/graphql/types/work_items/widgets/description_type_spec.rb11
-rw-r--r--spec/graphql/types/work_items/widgets/hierarchy_type_spec.rb11
22 files changed, 298 insertions, 35 deletions
diff --git a/spec/graphql/types/base_edge_spec.rb b/spec/graphql/types/base_edge_spec.rb
index 3afb4202173..b02ccbaffef 100644
--- a/spec/graphql/types/base_edge_spec.rb
+++ b/spec/graphql/types/base_edge_spec.rb
@@ -25,7 +25,6 @@ RSpec.describe Types::BaseEdge do
Class.new(GraphQL::Schema) do
lazy_resolve ::Gitlab::Graphql::Lazy, :force
- use ::GraphQL::Pagination::Connections
use ::Gitlab::Graphql::Pagination::Connections
query(Class.new(::Types::BaseObject) do
diff --git a/spec/graphql/types/base_field_spec.rb b/spec/graphql/types/base_field_spec.rb
index 9d02f061435..439678e7e16 100644
--- a/spec/graphql/types/base_field_spec.rb
+++ b/spec/graphql/types/base_field_spec.rb
@@ -3,6 +3,92 @@
require 'spec_helper'
RSpec.describe Types::BaseField do
+ describe 'authorized?' do
+ let(:object) { double }
+ let(:current_user) { nil }
+ let(:ctx) { { current_user: current_user } }
+
+ it 'defaults to true' do
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true)
+
+ expect(field).to be_authorized(object, nil, ctx)
+ end
+
+ it 'tests the field authorization, if provided' do
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true, authorize: :foo)
+
+ expect(Ability).to receive(:allowed?).with(current_user, :foo, object).and_return(false)
+
+ expect(field).not_to be_authorized(object, nil, ctx)
+ end
+
+ it 'tests the field authorization, if provided, when it succeeds' do
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true, authorize: :foo)
+
+ expect(Ability).to receive(:allowed?).with(current_user, :foo, object).and_return(true)
+
+ expect(field).to be_authorized(object, nil, ctx)
+ end
+
+ it 'only tests the resolver authorization if it authorizes_object?' do
+ resolver = Class.new
+
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true,
+ resolver_class: resolver)
+
+ expect(field).to be_authorized(object, nil, ctx)
+ end
+
+ it 'tests the resolver authorization, if provided' do
+ resolver = Class.new do
+ include Gitlab::Graphql::Authorize::AuthorizeResource
+
+ authorizes_object!
+ end
+
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true,
+ resolver_class: resolver)
+
+ expect(resolver).to receive(:authorized?).with(object, ctx).and_return(false)
+
+ expect(field).not_to be_authorized(object, nil, ctx)
+ end
+
+ it 'tests field authorization before resolver authorization, when field auth fails' do
+ resolver = Class.new do
+ include Gitlab::Graphql::Authorize::AuthorizeResource
+
+ authorizes_object!
+ end
+
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true,
+ authorize: :foo,
+ resolver_class: resolver)
+
+ expect(Ability).to receive(:allowed?).with(current_user, :foo, object).and_return(false)
+ expect(resolver).not_to receive(:authorized?)
+
+ expect(field).not_to be_authorized(object, nil, ctx)
+ end
+
+ it 'tests field authorization before resolver authorization, when field auth succeeds' do
+ resolver = Class.new do
+ include Gitlab::Graphql::Authorize::AuthorizeResource
+
+ authorizes_object!
+ end
+
+ field = described_class.new(name: 'test', type: GraphQL::Types::String, null: true,
+ authorize: :foo,
+ resolver_class: resolver)
+
+ expect(Ability).to receive(:allowed?).with(current_user, :foo, object).and_return(true)
+ expect(resolver).to receive(:authorized?).with(object, ctx).and_return(false)
+
+ expect(field).not_to be_authorized(object, nil, ctx)
+ end
+ end
+
context 'when considering complexity' do
let(:resolver) do
Class.new(described_class) do
diff --git a/spec/graphql/types/base_object_spec.rb b/spec/graphql/types/base_object_spec.rb
index 45dc885ecba..3c42c708187 100644
--- a/spec/graphql/types/base_object_spec.rb
+++ b/spec/graphql/types/base_object_spec.rb
@@ -137,7 +137,6 @@ RSpec.describe Types::BaseObject do
Class.new(GraphQL::Schema) do
lazy_resolve ::Gitlab::Graphql::Lazy, :force
- use ::GraphQL::Pagination::Connections
use ::Gitlab::Graphql::Pagination::Connections
query(Class.new(::Types::BaseObject) do
diff --git a/spec/graphql/types/ci/detailed_status_type_spec.rb b/spec/graphql/types/ci/detailed_status_type_spec.rb
index 5ed79b73a47..0c05227aec2 100644
--- a/spec/graphql/types/ci/detailed_status_type_spec.rb
+++ b/spec/graphql/types/ci/detailed_status_type_spec.rb
@@ -17,12 +17,10 @@ RSpec.describe Types::Ci::DetailedStatusType do
describe 'id field' do
it 'correctly renders the field' do
- parent_object = double(:parent_object, object: stage)
- parent = double(:parent, object: parent_object)
status = stage.detailed_status(stage.pipeline.user)
expected_id = "#{status.id}-#{stage.id}"
- expect(resolve_field('id', status, extras: { parent: parent })).to eq(expected_id)
+ expect(resolve_field('id', status, extras: { parent: stage }, arg_style: :internal)).to eq(expected_id)
end
end
@@ -38,7 +36,7 @@ RSpec.describe Types::Ci::DetailedStatusType do
title: status.action_title
}
- expect(resolve_field('action', status)).to eq(expected_status)
+ expect(resolve_field('action', status, arg_style: :internal)).to eq(expected_status)
end
end
end
diff --git a/spec/graphql/types/ci/pipeline_merge_request_event_type_enum_spec.rb b/spec/graphql/types/ci/pipeline_merge_request_event_type_enum_spec.rb
new file mode 100644
index 00000000000..3a90e4f1fd9
--- /dev/null
+++ b/spec/graphql/types/ci/pipeline_merge_request_event_type_enum_spec.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['PipelineMergeRequestEventType'] do
+ specify { expect(described_class.graphql_name).to eq('PipelineMergeRequestEventType') }
+
+ it 'has specific values' do
+ expect(described_class.values).to match a_hash_including(
+ 'MERGED_RESULT' => have_attributes(value: :merged_result),
+ 'DETACHED' => have_attributes(value: :detached)
+ )
+ end
+end
diff --git a/spec/graphql/types/ci/pipeline_type_spec.rb b/spec/graphql/types/ci/pipeline_type_spec.rb
index 94d1b42da37..9dee834d05f 100644
--- a/spec/graphql/types/ci/pipeline_type_spec.rb
+++ b/spec/graphql/types/ci/pipeline_type_spec.rb
@@ -14,7 +14,7 @@ RSpec.describe Types::Ci::PipelineType do
coverage created_at updated_at started_at finished_at committed_at
stages user retryable cancelable jobs source_job job job_artifacts downstream
upstream path project active user_permissions warnings commit commit_path uses_needs
- test_report_summary test_suite ref ref_path warning_messages
+ test_report_summary test_suite ref ref_path warning_messages merge_request_event_type
]
if Gitlab.ee?
diff --git a/spec/graphql/types/ci/runner_type_spec.rb b/spec/graphql/types/ci/runner_type_spec.rb
index 26ac7a4da8d..4ec35db13fb 100644
--- a/spec/graphql/types/ci/runner_type_spec.rb
+++ b/spec/graphql/types/ci/runner_type_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe GitlabSchema.types['CiRunner'] do
id description created_at contacted_at maximum_timeout access_level active paused status
version short_sha revision locked run_untagged ip_address runner_type tag_list
project_count job_count admin_url edit_admin_url user_permissions executor_name architecture_name platform_name
- maintenance_note groups projects jobs token_expires_at
+ maintenance_note maintenance_note_html groups projects jobs token_expires_at owner_project
]
expect(described_class).to include_graphql_fields(*expected_fields)
diff --git a/spec/graphql/types/ci/status_action_type_spec.rb b/spec/graphql/types/ci/status_action_type_spec.rb
index ab7dee3dd11..4c467bf240e 100644
--- a/spec/graphql/types/ci/status_action_type_spec.rb
+++ b/spec/graphql/types/ci/status_action_type_spec.rb
@@ -25,15 +25,9 @@ RSpec.describe Types::Ci::StatusActionType do
stage = build(:ci_stage_entity, status: :skipped)
status = stage.detailed_status(stage.pipeline.user)
- grandparent_object = double(:grandparent_object, object: stage)
- parent_object = double(:parent_object, object: status)
-
- grandparent = double(:parent, object: grandparent_object)
- parent = double(:parent, object: parent_object, parent: grandparent)
-
expected_id = "#{stage.class.name}-#{status.id}"
- expect(resolve_field('id', status, extras: { parent: parent })).to eq(expected_id)
+ expect(resolve_field('id', status, extras: { parent: status }, arg_style: :internal)).to eq(expected_id)
end
end
end
diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb
index 1d4590cbb4e..e7454b85357 100644
--- a/spec/graphql/types/issue_type_spec.rb
+++ b/spec/graphql/types/issue_type_spec.rb
@@ -18,7 +18,7 @@ RSpec.describe GitlabSchema.types['Issue'] do
confidential hidden 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 customer_relations_contacts escalation_status]
+ closed_as_duplicate_of create_note_email timelogs project_id customer_relations_contacts escalation_status]
fields.each do |field_name|
expect(described_class).to have_graphql_field(field_name)
@@ -291,14 +291,6 @@ RSpec.describe GitlabSchema.types['Issue'] do
let!(:escalation_status) { create(:incident_management_issuable_escalation_status, issue: issue) }
it { is_expected.to eq(escalation_status.status_name.to_s.upcase) }
-
- context 'with feature disabled' do
- before do
- stub_feature_flags(incident_escalations: false)
- end
-
- it { is_expected.to be_nil }
- end
end
end
end
diff --git a/spec/graphql/types/limited_countable_connection_type_spec.rb b/spec/graphql/types/limited_countable_connection_type_spec.rb
new file mode 100644
index 00000000000..30af26cdb83
--- /dev/null
+++ b/spec/graphql/types/limited_countable_connection_type_spec.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::LimitedCountableConnectionType do
+ it 'has the expected fields' do
+ expected_fields = %i[count page_info]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/packages/cleanup/keep_duplicated_package_files_enum_spec.rb b/spec/graphql/types/packages/cleanup/keep_duplicated_package_files_enum_spec.rb
new file mode 100644
index 00000000000..d7f24a9edfd
--- /dev/null
+++ b/spec/graphql/types/packages/cleanup/keep_duplicated_package_files_enum_spec.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['PackagesCleanupKeepDuplicatedPackageFilesEnum'] do
+ it 'exposes all options' do
+ expect(described_class.values.keys)
+ .to contain_exactly(*Types::Packages::Cleanup::KeepDuplicatedPackageFilesEnum::OPTIONS_MAPPING.values)
+ end
+
+ it 'uses all possible options from model' do
+ all_options = Packages::Cleanup::Policy::KEEP_N_DUPLICATED_PACKAGE_FILES_VALUES
+ expect(described_class::OPTIONS_MAPPING.keys).to contain_exactly(*all_options)
+ end
+end
diff --git a/spec/graphql/types/packages/cleanup/policy_type_spec.rb b/spec/graphql/types/packages/cleanup/policy_type_spec.rb
new file mode 100644
index 00000000000..f48651ed832
--- /dev/null
+++ b/spec/graphql/types/packages/cleanup/policy_type_spec.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['PackagesCleanupPolicy'] do
+ specify { expect(described_class.graphql_name).to eq('PackagesCleanupPolicy') }
+
+ specify do
+ expect(described_class.description)
+ .to eq('A packages cleanup policy designed to keep only packages and packages assets that matter most')
+ end
+
+ specify { expect(described_class).to require_graphql_authorizations(:admin_package) }
+
+ describe 'keep_n_duplicated_package_files' do
+ subject { described_class.fields['keepNDuplicatedPackageFiles'] }
+
+ it { is_expected.to have_non_null_graphql_type(Types::Packages::Cleanup::KeepDuplicatedPackageFilesEnum) }
+ end
+
+ describe 'next_run_at' do
+ subject { described_class.fields['nextRunAt'] }
+
+ it { is_expected.to have_nullable_graphql_type(Types::TimeType) }
+ end
+end
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb
index a08bd717c72..2e994bf7820 100644
--- a/spec/graphql/types/project_type_spec.rb
+++ b/spec/graphql/types/project_type_spec.rb
@@ -36,12 +36,40 @@ RSpec.describe GitlabSchema.types['Project'] do
pipeline_analytics squash_read_only sast_ci_configuration
cluster_agent cluster_agents agent_configurations
ci_template timelogs merge_commit_template squash_commit_template work_item_types
- recent_issue_boards ci_config_path_or_default
+ recent_issue_boards ci_config_path_or_default packages_cleanup_policy
]
expect(described_class).to include_graphql_fields(*expected_fields)
end
+ describe 'count' do
+ let_it_be(:user) { create(:user) }
+
+ let(:query) do
+ %(
+ query {
+ projects {
+ count
+ edges {
+ node {
+ id
+ }
+ }
+ }
+ }
+ )
+ end
+
+ subject { GitlabSchema.execute(query, context: { current_user: user }).as_json }
+
+ it 'returns valid projects count' do
+ create(:project, namespace: user.namespace)
+ create(:project, namespace: user.namespace)
+
+ expect(subject.dig('data', 'projects', 'count')).to eq(2)
+ end
+ end
+
describe 'container_registry_enabled' do
let_it_be(:project, reload: true) { create(:project, :public) }
let_it_be(:user) { create(:user) }
@@ -393,6 +421,12 @@ RSpec.describe GitlabSchema.types['Project'] do
it { is_expected.to have_graphql_type(Types::ContainerExpirationPolicyType) }
end
+ describe 'packages cleanup policy field' do
+ subject { described_class.fields['packagesCleanupPolicy'] }
+
+ it { is_expected.to have_graphql_type(Types::Packages::Cleanup::PolicyType) }
+ end
+
describe 'terraform state field' do
subject { described_class.fields['terraformState'] }
diff --git a/spec/graphql/types/terraform/state_type_spec.rb b/spec/graphql/types/terraform/state_type_spec.rb
index 9f65bb926d7..5098adbf45c 100644
--- a/spec/graphql/types/terraform/state_type_spec.rb
+++ b/spec/graphql/types/terraform/state_type_spec.rb
@@ -7,7 +7,7 @@ RSpec.describe GitlabSchema.types['TerraformState'] do
it { expect(described_class).to require_graphql_authorizations(:read_terraform_state) }
describe 'fields' do
- let(:fields) { %i[id name locked_by_user locked_at latest_version created_at updated_at] }
+ let(:fields) { %i[id name locked_by_user locked_at latest_version created_at updated_at deleted_at] }
it { expect(described_class).to have_graphql_fields(fields) }
@@ -17,6 +17,7 @@ RSpec.describe GitlabSchema.types['TerraformState'] do
it { expect(described_class.fields['lockedAt'].type).not_to be_non_null }
it { expect(described_class.fields['createdAt'].type).to be_non_null }
it { expect(described_class.fields['updatedAt'].type).to be_non_null }
+ it { expect(described_class.fields['deletedAt'].type).not_to be_non_null }
it { expect(described_class.fields['latestVersion'].type).not_to be_non_null }
it { expect(described_class.fields['latestVersion'].complexity).to eq(3) }
diff --git a/spec/graphql/types/time_type_spec.rb b/spec/graphql/types/time_type_spec.rb
index 3b0d257e1d7..367a2371694 100644
--- a/spec/graphql/types/time_type_spec.rb
+++ b/spec/graphql/types/time_type_spec.rb
@@ -21,8 +21,7 @@ RSpec.describe GitlabSchema.types['Time'] do
.to raise_error(GraphQL::CoercionError)
end
- it 'rejects nil' do
- expect { described_class.coerce_isolated_input(nil) }
- .to raise_error(GraphQL::CoercionError)
+ it 'allows nil' do
+ expect(described_class.coerce_isolated_input(nil)).to be_nil
end
end
diff --git a/spec/graphql/types/todo_type_spec.rb b/spec/graphql/types/todo_type_spec.rb
index 8de63ebfda5..c7bb7c67959 100644
--- a/spec/graphql/types/todo_type_spec.rb
+++ b/spec/graphql/types/todo_type_spec.rb
@@ -4,7 +4,19 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['Todo'] do
it 'has the correct fields' do
- expected_fields = [:id, :project, :group, :author, :action, :target, :target_type, :body, :state, :created_at]
+ expected_fields = [
+ :id,
+ :project,
+ :group,
+ :author,
+ :action,
+ :target,
+ :target_type,
+ :body,
+ :state,
+ :created_at,
+ :note
+ ]
expect(described_class).to have_graphql_fields(*expected_fields)
end
diff --git a/spec/graphql/types/user_type_spec.rb b/spec/graphql/types/user_type_spec.rb
index c913a4c3662..fec6a771640 100644
--- a/spec/graphql/types/user_type_spec.rb
+++ b/spec/graphql/types/user_type_spec.rb
@@ -91,8 +91,8 @@ RSpec.describe GitlabSchema.types['User'] do
context 'when requester is nil' do
let(:current_user) { nil }
- it 'returns `****`' do
- expect(user_name).to eq('****')
+ it 'returns nothing' do
+ expect(user_name).to be_nil
end
end
@@ -134,8 +134,8 @@ RSpec.describe GitlabSchema.types['User'] do
context 'when requester is nil' do
let(:current_user) { nil }
- it 'returns `****`' do
- expect(user_name).to eq('****')
+ it 'returns nothing' do
+ expect(user_name).to be_nil
end
end
diff --git a/spec/graphql/types/work_item_type_spec.rb b/spec/graphql/types/work_item_type_spec.rb
index a0480506156..7ed58786b5b 100644
--- a/spec/graphql/types/work_item_type_spec.rb
+++ b/spec/graphql/types/work_item_type_spec.rb
@@ -10,7 +10,18 @@ RSpec.describe GitlabSchema.types['WorkItem'] do
specify { expect(described_class).to expose_permissions_using(Types::PermissionTypes::WorkItem) }
it 'has specific fields' do
- fields = %i[description description_html id iid lock_version state title title_html userPermissions work_item_type]
+ fields = %i[
+ description
+ description_html
+ id
+ iid
+ lock_version
+ state title
+ title_html
+ userPermissions
+ widgets
+ work_item_type
+ ]
fields.each do |field_name|
expect(described_class).to have_graphql_fields(*fields)
diff --git a/spec/graphql/types/work_items/widget_interface_spec.rb b/spec/graphql/types/work_items/widget_interface_spec.rb
new file mode 100644
index 00000000000..ee40bcc10ca
--- /dev/null
+++ b/spec/graphql/types/work_items/widget_interface_spec.rb
@@ -0,0 +1,37 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::WorkItems::WidgetInterface do
+ include GraphqlHelpers
+
+ it 'exposes the expected fields' do
+ expected_fields = %i[type]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+
+ describe ".resolve_type" do
+ using RSpec::Parameterized::TableSyntax
+
+ where(:widget_class, :widget_type_name) do
+ WorkItems::Widgets::Description | Types::WorkItems::Widgets::DescriptionType
+ WorkItems::Widgets::Hierarchy | Types::WorkItems::Widgets::HierarchyType
+ end
+
+ with_them do
+ it 'knows the correct type for objects' do
+ expect(
+ described_class.resolve_type(widget_class.new(build(:work_item)), {})
+ ).to eq(widget_type_name)
+ end
+ end
+
+ it 'raises an error for an unknown type' do
+ project = build(:project)
+
+ expect { described_class.resolve_type(project, {}) }
+ .to raise_error("Unknown GraphQL type for widget #{project}")
+ end
+ end
+end
diff --git a/spec/graphql/types/work_items/widget_type_enum_spec.rb b/spec/graphql/types/work_items/widget_type_enum_spec.rb
new file mode 100644
index 00000000000..e7ac9b9c317
--- /dev/null
+++ b/spec/graphql/types/work_items/widget_type_enum_spec.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe GitlabSchema.types['WorkItemWidgetType'] do
+ specify { expect(described_class.graphql_name).to eq('WorkItemWidgetType') }
+
+ it 'exposes all the existing widget type values' do
+ expect(described_class.values.transform_values { |v| v.value }).to include(
+ 'DESCRIPTION' => :description
+ )
+ end
+end
diff --git a/spec/graphql/types/work_items/widgets/description_type_spec.rb b/spec/graphql/types/work_items/widgets/description_type_spec.rb
new file mode 100644
index 00000000000..5ade1fe4aa2
--- /dev/null
+++ b/spec/graphql/types/work_items/widgets/description_type_spec.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::WorkItems::Widgets::DescriptionType do
+ it 'exposes the expected fields' do
+ expected_fields = %i[description description_html type]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end
diff --git a/spec/graphql/types/work_items/widgets/hierarchy_type_spec.rb b/spec/graphql/types/work_items/widgets/hierarchy_type_spec.rb
new file mode 100644
index 00000000000..1722a07c5f4
--- /dev/null
+++ b/spec/graphql/types/work_items/widgets/hierarchy_type_spec.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Types::WorkItems::Widgets::HierarchyType do
+ it 'exposes the expected fields' do
+ expected_fields = %i[parent children type]
+
+ expect(described_class).to have_graphql_fields(*expected_fields)
+ end
+end