diff options
Diffstat (limited to 'spec/graphql/resolvers')
5 files changed, 57 insertions, 24 deletions
diff --git a/spec/graphql/resolvers/clusters/agent_tokens_resolver_spec.rb b/spec/graphql/resolvers/clusters/agent_tokens_resolver_spec.rb index 6b8b88928d8..9b54d466681 100644 --- a/spec/graphql/resolvers/clusters/agent_tokens_resolver_spec.rb +++ b/spec/graphql/resolvers/clusters/agent_tokens_resolver_spec.rb @@ -7,6 +7,7 @@ RSpec.describe Resolvers::Clusters::AgentTokensResolver do it { expect(described_class.type).to eq(Types::Clusters::AgentTokenType) } it { expect(described_class.null).to be_truthy } + it { expect(described_class.arguments.keys).to contain_exactly('status') } describe '#resolve' do let(:agent) { create(:cluster_agent) } @@ -23,6 +24,14 @@ RSpec.describe Resolvers::Clusters::AgentTokensResolver do expect(subject).to eq([matching_token2, matching_token1]) end + context 'token status is specified' do + let!(:revoked_token) { create(:cluster_agent_token, :revoked, agent: agent) } + + subject { resolve(described_class, obj: agent, ctx: ctx, args: { status: 'revoked' }) } + + it { is_expected.to contain_exactly(revoked_token) } + end + context 'user does not have permission' do let(:user) { create(:user, developer_projects: [agent.project]) } diff --git a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb index 3fcfa967452..9fe4c78f551 100644 --- a/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb +++ b/spec/graphql/resolvers/concerns/resolves_pipelines_spec.rb @@ -62,24 +62,12 @@ RSpec.describe ResolvesPipelines do context 'filtering by source' do let_it_be(:source_pipeline) { create(:ci_pipeline, project: project, source: 'web') } - context 'when `dast_view_scans` feature flag is disabled' do - before do - stub_feature_flags(dast_view_scans: false) - end - - it 'does not filter by source' do - expect(resolve_pipelines(source: 'web')).to contain_exactly(*all_pipelines, source_pipeline) - end + it 'does filter by source' do + expect(resolve_pipelines(source: 'web')).to contain_exactly(source_pipeline) end - context 'when `dast_view_scans` feature flag is enabled' do - it 'does filter by source' do - expect(resolve_pipelines(source: 'web')).to contain_exactly(source_pipeline) - end - - it 'returns all the pipelines' do - expect(resolve_pipelines).to contain_exactly(*all_pipelines, source_pipeline) - end + it 'returns all the pipelines' do + expect(resolve_pipelines).to contain_exactly(*all_pipelines, source_pipeline) end end diff --git a/spec/graphql/resolvers/merge_requests_resolver_spec.rb b/spec/graphql/resolvers/merge_requests_resolver_spec.rb index a931b0a3f77..1d0eac30a23 100644 --- a/spec/graphql/resolvers/merge_requests_resolver_spec.rb +++ b/spec/graphql/resolvers/merge_requests_resolver_spec.rb @@ -172,6 +172,28 @@ RSpec.describe Resolvers::MergeRequestsResolver do end end + context 'with draft argument' do + before do + merge_request_4.update!(title: MergeRequest.wip_title(merge_request_4.title)) + end + + context 'with draft: true argument' do + it 'takes one argument' do + result = resolve_mr(project, draft: true) + + expect(result).to contain_exactly(merge_request_4) + end + end + + context 'with draft: false argument' do + it 'takes one argument' do + result = resolve_mr(project, draft: false) + + expect(result).not_to contain_exactly(merge_request_1, merge_request_2, merge_request_3, merge_request_5, merge_request_6) + end + end + end + context 'with label argument' do let_it_be(:label) { merge_request_6.labels.first } let_it_be(:with_label) { create(:labeled_merge_request, :closed, labels: [label], **common_attrs) } diff --git a/spec/graphql/resolvers/users/groups_resolver_spec.rb b/spec/graphql/resolvers/users/groups_resolver_spec.rb index 0fdb6da5ae9..5ac7aac4898 100644 --- a/spec/graphql/resolvers/users/groups_resolver_spec.rb +++ b/spec/graphql/resolvers/users/groups_resolver_spec.rb @@ -26,14 +26,6 @@ RSpec.describe Resolvers::Users::GroupsResolver do public_maintainer_group.add_maintainer(user) end - context 'when paginatable_namespace_drop_down_for_project_creation feature flag is disabled' do - before do - stub_feature_flags(paginatable_namespace_drop_down_for_project_creation: false) - end - - it { is_expected.to be_nil } - end - context 'when resolver object is current user' do context 'when permission is :create_projects' do let(:group_arguments) { { permission_scope: :create_projects } } diff --git a/spec/graphql/resolvers/work_items/types_resolver_spec.rb b/spec/graphql/resolvers/work_items/types_resolver_spec.rb new file mode 100644 index 00000000000..b85989256b5 --- /dev/null +++ b/spec/graphql/resolvers/work_items/types_resolver_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Resolvers::WorkItems::TypesResolver do + include GraphqlHelpers + + let_it_be(:current_user) { create(:user) } + let_it_be(:group) { create(:group) } + + before_all do + group.add_developer(current_user) + end + + describe '#resolve' do + it 'returns all default work item types' do + result = resolve(described_class, obj: group) + + expect(result.to_a).to match(WorkItems::Type.default.order_by_name_asc) + end + end +end |