From 6cf1ed449a0c75fc5c776a59f9ca6bde5386f28d Mon Sep 17 00:00:00 2001 From: Alfred Mazimbe Date: Fri, 28 Feb 2025 13:12:36 +0000 Subject: [PATCH] Updated failing NPM6 tests to use NPM8 fixtures as NPM6 is deprecated --- .../dependabot/npm_and_yarn/file_fetcher_spec.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_fetcher_spec.rb b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_fetcher_spec.rb index 9d6f2a10b85..ba7dfd0b1c3 100644 --- a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_fetcher_spec.rb +++ b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_fetcher_spec.rb @@ -607,11 +607,18 @@ stub_request(:get, File.join(url, "yarn.lock?ref=sha")) .with(headers: { "Authorization" => "token token" }) .to_return(status: 404) + stub_request(:get, File.join(url, "package.json?ref=sha")) + .with(headers: { "Authorization" => "token token" }) + .to_return( + status: 200, + body: fixture_to_response("projects/npm8/simple", "package.json"), + headers: json_header + ) stub_request(:get, File.join(url, "package-lock.json?ref=sha")) .with(headers: { "Authorization" => "token token" }) .to_return( status: 200, - body: fixture("github", "package_lock_content.json"), + body: fixture_to_response("projects/npm8/simple", "package-lock.json"), headers: json_header ) end @@ -623,7 +630,7 @@ it "parses the npm lockfile" do expect(file_fetcher_instance.ecosystem_versions).to eq( - { package_managers: { "npm" => 6 } } + { package_managers: { "npm" => 8 } } ) end end @@ -648,7 +655,7 @@ .with(headers: { "Authorization" => "token token" }) .to_return( status: 200, - body: fixture("github", "package_lock_content.json"), + body: fixture_to_response("projects/npm8/simple", "package-lock.json"), headers: json_header ) end @@ -660,7 +667,7 @@ it "parses the package manager version" do expect(file_fetcher_instance.ecosystem_versions).to eq( - { package_managers: { "npm" => 6, "yarn" => 1 } } + { package_managers: { "npm" => 8, "yarn" => 1 } } ) end end