diff options
Diffstat (limited to 'spec/services/packages/npm')
-rw-r--r-- | spec/services/packages/npm/create_package_service_spec.rb | 2 | ||||
-rw-r--r-- | spec/services/packages/npm/generate_metadata_service_spec.rb | 16 |
2 files changed, 16 insertions, 2 deletions
diff --git a/spec/services/packages/npm/create_package_service_spec.rb b/spec/services/packages/npm/create_package_service_spec.rb index 867dc582771..f02e53b67cb 100644 --- a/spec/services/packages/npm/create_package_service_spec.rb +++ b/spec/services/packages/npm/create_package_service_spec.rb @@ -322,7 +322,7 @@ RSpec.describe Packages::Npm::CreatePackageService, feature_category: :package_r it { expect(subject[:message]).to eq 'Could not obtain package lease. Please try again.' } end - context 'when feature flag :packages_package_protection is disabled' do + context 'when feature flag :packages_protected_packages disabled' do let_it_be_with_reload(:package_protection_rule) { create(:package_protection_rule, package_type: :npm, project: project) } before do diff --git a/spec/services/packages/npm/generate_metadata_service_spec.rb b/spec/services/packages/npm/generate_metadata_service_spec.rb index f5d7f13d22c..ad3d4fde665 100644 --- a/spec/services/packages/npm/generate_metadata_service_spec.rb +++ b/spec/services/packages/npm/generate_metadata_service_spec.rb @@ -5,7 +5,8 @@ require 'spec_helper' RSpec.describe ::Packages::Npm::GenerateMetadataService, feature_category: :package_registry do using RSpec::Parameterized::TableSyntax - let_it_be(:project) { create(:project) } + let_it_be(:group) { create(:group) } + let_it_be(:project) { create(:project, namespace: group) } let_it_be(:package_name) { "@#{project.root_namespace.path}/test" } let_it_be(:package1) { create(:npm_package, version: '2.0.4', project: project, name: package_name) } let_it_be(:package2) { create(:npm_package, version: '2.0.6', project: project, name: package_name) } @@ -156,6 +157,19 @@ RSpec.describe ::Packages::Npm::GenerateMetadataService, feature_category: :pack end end end + + context 'with duplicate tags' do + let_it_be(:project2) { create(:project, namespace: group) } + let_it_be(:package2) { create(:npm_package, version: '3.0.0', project: project2, name: package_name) } + let_it_be(:package_tag1) { create(:packages_tag, package: package1, name: 'latest') } + let_it_be(:package_tag2) { create(:packages_tag, package: package2, name: 'latest') } + + let(:packages) { ::Packages::Package.for_projects([project.id, project2.id]).with_name(package_name) } + + it "returns the tag of the latest package's version" do + expect(subject['latest']).to eq(package2.version) + end + end end end |