diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-05 03:11:48 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2024-01-05 03:11:48 +0300 |
commit | a95580cc56f2a94110f07c84947b1bb6c959befb (patch) | |
tree | d7249e16fe682b7ce2e5df1031db8cc96ea39cb8 /spec/graphql | |
parent | 808b8561f4e75b2db7c7e94a6c7651efb546048b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/graphql')
-rw-r--r-- | spec/graphql/resolvers/ci/catalog/resources/versions_resolver_spec.rb | 20 | ||||
-rw-r--r-- | spec/graphql/types/ci/catalog/resources/version_type_spec.rb | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/spec/graphql/resolvers/ci/catalog/resources/versions_resolver_spec.rb b/spec/graphql/resolvers/ci/catalog/resources/versions_resolver_spec.rb index 1ce0e91765f..4205259e5b9 100644 --- a/spec/graphql/resolvers/ci/catalog/resources/versions_resolver_spec.rb +++ b/spec/graphql/resolvers/ci/catalog/resources/versions_resolver_spec.rb @@ -7,8 +7,9 @@ RSpec.describe Resolvers::Ci::Catalog::Resources::VersionsResolver, feature_cate include_context 'when there are catalog resources with versions' + let(:name) { nil } let(:sort) { nil } - let(:args) { { sort: sort }.compact } + let(:args) { { name: name, sort: sort }.compact } let(:ctx) { { current_user: current_user } } subject(:result) { resolve(described_class, ctx: ctx, obj: resource1, args: args) } @@ -19,6 +20,23 @@ RSpec.describe Resolvers::Ci::Catalog::Resources::VersionsResolver, feature_cate resource1.project.add_guest(current_user) end + context 'when name argument is provided' do + let(:name) { 'v1.0' } + + it 'returns the version that matches the name' do + expect(result.items.size).to eq(1) + expect(result.items.first.name).to eq('v1.0') + end + + context 'when no version matches the name' do + let(:name) { 'does_not_exist' } + + it 'returns empty response' do + expect(result).to be_empty + end + end + end + context 'when sort argument is not provided' do it 'returns versions ordered by released_at descending' do expect(result.items).to eq([v1_1, v1_0]) diff --git a/spec/graphql/types/ci/catalog/resources/version_type_spec.rb b/spec/graphql/types/ci/catalog/resources/version_type_spec.rb index e218be57819..10eea90e949 100644 --- a/spec/graphql/types/ci/catalog/resources/version_type_spec.rb +++ b/spec/graphql/types/ci/catalog/resources/version_type_spec.rb @@ -17,6 +17,7 @@ RSpec.describe Types::Ci::Catalog::Resources::VersionType, feature_category: :pi author commit components + readme_html ] expect(described_class).to have_graphql_fields(*expected_fields) |