diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 09:09:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-08 09:09:54 +0300 |
commit | f6cdec670b9b757fc2225a2c6627ab79765e5b8a (patch) | |
tree | 7a1fde030f117b69332d01b22deefd1c81fff458 /spec/graphql/types | |
parent | e2ee1eec50aa8df8543d7ecc585ec0ba5ee544ac (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql/types')
-rw-r--r-- | spec/graphql/types/project_type_spec.rb | 14 | ||||
-rw-r--r-- | spec/graphql/types/projects/base_service_type_spec.rb | 13 | ||||
-rw-r--r-- | spec/graphql/types/projects/jira_service_type_spec.rb | 13 | ||||
-rw-r--r-- | spec/graphql/types/projects/service_type_spec.rb | 16 | ||||
-rw-r--r-- | spec/graphql/types/projects/services_enum_spec.rb | 15 |
5 files changed, 70 insertions, 1 deletions
diff --git a/spec/graphql/types/project_type_spec.rb b/spec/graphql/types/project_type_spec.rb index 0c8be50ed90..6ea852190c9 100644 --- a/spec/graphql/types/project_type_spec.rb +++ b/spec/graphql/types/project_type_spec.rb @@ -24,7 +24,7 @@ describe GitlabSchema.types['Project'] do namespace group statistics repository merge_requests merge_request issues issue pipelines removeSourceBranchAfterMerge sentryDetailedError snippets grafanaIntegration autocloseReferencedIssues suggestion_commit_message environments - boards jira_import_status jira_imports + boards jira_import_status jira_imports services ] expect(described_class).to include_graphql_fields(*expected_fields) @@ -84,4 +84,16 @@ describe GitlabSchema.types['Project'] do it { is_expected.to have_graphql_type(Types::BoardType.connection_type) } end + + describe 'jira_imports field' do + subject { described_class.fields['jiraImports'] } + + it { is_expected.to have_graphql_type(Types::JiraImportType.connection_type) } + end + + describe 'services field' do + subject { described_class.fields['services'] } + + it { is_expected.to have_graphql_type(Types::Projects::ServiceType.connection_type) } + end end diff --git a/spec/graphql/types/projects/base_service_type_spec.rb b/spec/graphql/types/projects/base_service_type_spec.rb new file mode 100644 index 00000000000..bda6022bf79 --- /dev/null +++ b/spec/graphql/types/projects/base_service_type_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe GitlabSchema.types['BaseService'] do + it { expect(described_class.graphql_name).to eq('BaseService') } + + it 'has basic expected fields' do + expect(described_class).to have_graphql_fields(:type, :active) + end + + it { expect(described_class).to require_graphql_authorizations(:admin_project) } +end diff --git a/spec/graphql/types/projects/jira_service_type_spec.rb b/spec/graphql/types/projects/jira_service_type_spec.rb new file mode 100644 index 00000000000..7f8fa6538e9 --- /dev/null +++ b/spec/graphql/types/projects/jira_service_type_spec.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe GitlabSchema.types['JiraService'] do + it { expect(described_class.graphql_name).to eq('JiraService') } + + it 'has basic expected fields' do + expect(described_class).to have_graphql_fields(:type, :active) + end + + it { expect(described_class).to require_graphql_authorizations(:admin_project) } +end diff --git a/spec/graphql/types/projects/service_type_spec.rb b/spec/graphql/types/projects/service_type_spec.rb new file mode 100644 index 00000000000..ad30a4008bc --- /dev/null +++ b/spec/graphql/types/projects/service_type_spec.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Types::Projects::ServiceType do + it { expect(described_class).to have_graphql_fields(:type, :active) } + + describe ".resolve_type" do + it 'resolves the corresponding type for objects' do + expect(described_class.resolve_type(build(:jira_service), {})).to eq(Types::Projects::Services::JiraServiceType) + expect(described_class.resolve_type(build(:service), {})).to eq(Types::Projects::Services::BaseServiceType) + expect(described_class.resolve_type(build(:alerts_service), {})).to eq(Types::Projects::Services::BaseServiceType) + expect(described_class.resolve_type(build(:custom_issue_tracker_service), {})).to eq(Types::Projects::Services::BaseServiceType) + end + end +end diff --git a/spec/graphql/types/projects/services_enum_spec.rb b/spec/graphql/types/projects/services_enum_spec.rb new file mode 100644 index 00000000000..aac4aae4f69 --- /dev/null +++ b/spec/graphql/types/projects/services_enum_spec.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe GitlabSchema.types['ServiceType'] do + it { expect(described_class.graphql_name).to eq('ServiceType') } + + it 'exposes all the existing project services' do + expect(described_class.values.keys).to match_array(available_services_enum) + end +end + +def available_services_enum + ::Service.services_types.map(&:underscore).map(&:upcase) +end |