Commit fc1005a4 authored by nmccready's avatar nmccready

198645: node npm remove deprecated flag

Update package_presenter.rb

fix: #198645 dependency_link.rb removed deprecated flag

198645: fix spec npm_package_spec by removing :deprecated

198645: fix spec create_dependency_service_spec.rb by removing deprecated npm package identifier.

198645: more spec fixes related to npm deprecated being removed

198645: another npm unit test fix
parent 87d8c6d3
...@@ -8,7 +8,7 @@ class Packages::DependencyLink < ApplicationRecord ...@@ -8,7 +8,7 @@ class Packages::DependencyLink < ApplicationRecord
validates :dependency_type, validates :dependency_type,
uniqueness: { scope: %i[package_id dependency_id] } uniqueness: { scope: %i[package_id dependency_id] }
enum dependency_type: { dependencies: 1, devDependencies: 2, bundleDependencies: 3, peerDependencies: 4, deprecated: 5 } enum dependency_type: { dependencies: 1, devDependencies: 2, bundleDependencies: 3, peerDependencies: 4 }
scope :with_dependency_type, ->(dependency_type) { where(dependency_type: dependency_type) } scope :with_dependency_type, ->(dependency_type) { where(dependency_type: dependency_type) }
scope :includes_dependency, -> { includes(:dependency) } scope :includes_dependency, -> { includes(:dependency) }
......
...@@ -7,7 +7,7 @@ module Packages ...@@ -7,7 +7,7 @@ module Packages
attr_reader :name, :packages attr_reader :name, :packages
NPM_VALID_DEPENDENCY_TYPES = %i[dependencies devDependencies bundleDependencies peerDependencies deprecated].freeze NPM_VALID_DEPENDENCY_TYPES = %i[dependencies devDependencies bundleDependencies peerDependencies].freeze
def initialize(name, packages) def initialize(name, packages)
@name = name @name = name
......
...@@ -40,7 +40,6 @@ describe API::NpmPackages do ...@@ -40,7 +40,6 @@ describe API::NpmPackages do
let!(:package_dependency_link2) { create(:packages_dependency_link, package: package, dependency_type: :devDependencies) } let!(:package_dependency_link2) { create(:packages_dependency_link, package: package, dependency_type: :devDependencies) }
let!(:package_dependency_link3) { create(:packages_dependency_link, package: package, dependency_type: :bundleDependencies) } let!(:package_dependency_link3) { create(:packages_dependency_link, package: package, dependency_type: :bundleDependencies) }
let!(:package_dependency_link4) { create(:packages_dependency_link, package: package, dependency_type: :peerDependencies) } let!(:package_dependency_link4) { create(:packages_dependency_link, package: package, dependency_type: :peerDependencies) }
let!(:package_dependency_link5) { create(:packages_dependency_link, package: package, dependency_type: :deprecated) }
context 'a public project' do context 'a public project' do
it 'returns the package info without oauth token' do it 'returns the package info without oauth token' do
...@@ -301,7 +300,7 @@ describe API::NpmPackages do ...@@ -301,7 +300,7 @@ describe API::NpmPackages do
.to change { project.packages.count }.by(1) .to change { project.packages.count }.by(1)
.and change { Packages::PackageFile.count }.by(1) .and change { Packages::PackageFile.count }.by(1)
.and change { Packages::Dependency.count}.by(4) .and change { Packages::Dependency.count}.by(4)
.and change { Packages::DependencyLink.count}.by(7) .and change { Packages::DependencyLink.count}.by(6)
expect(response).to have_gitlab_http_status(200) expect(response).to have_gitlab_http_status(200)
end end
...@@ -317,7 +316,7 @@ describe API::NpmPackages do ...@@ -317,7 +316,7 @@ describe API::NpmPackages do
.to change { project.packages.count }.by(1) .to change { project.packages.count }.by(1)
.and change { Packages::PackageFile.count }.by(1) .and change { Packages::PackageFile.count }.by(1)
.and not_change { Packages::Dependency.count} .and not_change { Packages::Dependency.count}
.and change { Packages::DependencyLink.count}.by(7) .and change { Packages::DependencyLink.count}.by(6)
end end
end end
end end
......
...@@ -42,14 +42,14 @@ describe Packages::CreateDependencyService do ...@@ -42,14 +42,14 @@ describe Packages::CreateDependencyService do
it 'creates dependencies and links' do it 'creates dependencies and links' do
expect(Packages::Dependency) expect(Packages::Dependency)
.to receive(:ids_for_package_names_and_version_patterns) .to receive(:ids_for_package_names_and_version_patterns)
.exactly(5).times .exactly(4).times
.and_call_original .and_call_original
expect { subject } expect { subject }
.to change { Packages::Dependency.count }.by(4) .to change { Packages::Dependency.count }.by(4)
.and change { Packages::DependencyLink.count }.by(7) .and change { Packages::DependencyLink.count }.by(6)
expect(dependency_names).to match_array(%w(d3 d3 d3 dagre-d3 dagre-d3 express express)) expect(dependency_names).to match_array(%w(d3 d3 d3 dagre-d3 dagre-d3 express))
expect(dependency_link_types).to match_array(%w(bundleDependencies dependencies dependencies deprecated devDependencies devDependencies peerDependencies)) expect(dependency_link_types).to match_array(%w(bundleDependencies dependencies dependencies devDependencies devDependencies peerDependencies))
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment