Skip to content

Commit

Permalink
Junit fixes for composer v1
Browse files Browse the repository at this point in the history
  • Loading branch information
“Thavachelvam committed Jan 12, 2025
1 parent de09f82 commit 0bc1852
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,45 +243,6 @@
end
end

context "when an environment variable is required (composer v1)" do
let(:project_name) { "v1/env_variable" }

context "when it hasn't been provided" do
it "raises a MissingEnvironmentVariable error" do
expect { updated_lockfile_content }.to raise_error do |error|
expect(error).to be_a(Dependabot::MissingEnvironmentVariable)
expect(error.environment_variable).to eq("ACF_PRO_KEY")
end
end
end

context "when it has been provided" do
let(:updater) do
described_class.new(
dependency_files: files,
dependencies: [dependency],
credentials: [{
"type" => "git_source",
"host" => "github.com",
"username" => "x-access-token",
"password" => "token"
}, {
"type" => "php_environment_variable",
"env-key" => "ACF_PRO_KEY",
"env-value" => "example_key"
}]
)
end

it "runs just fine (we get a 404 here because our key is wrong)" do
expect { updated_lockfile_content }.to raise_error do |error|
expect(error).to be_a(Dependabot::DependencyFileNotResolvable)
expect(error.message).to include("404")
end
end
end
end

context "when an environment variable is required (composer v2)" do
let(:project_name) { "env_variable" }

Expand Down Expand Up @@ -631,40 +592,6 @@
end
end

context "when there are patches (composer v1)" do
let(:project_name) { "v1/patches" }

let(:dependency) do
Dependabot::Dependency.new(
name: "ehime/hello-world",
version: "1.0.5",
requirements: [{
file: "composer.json",
requirement: "1.0.5",
groups: [],
source: nil
}],
previous_version: "1.0.4",
previous_requirements: [{
file: "composer.json",
requirement: "1.0.4",
groups: [],
source: nil
}],
package_manager: "composer"
)
end

it "doesn't strip the patches" do
updated_dep = JSON.parse(updated_lockfile_content)
.fetch("packages")
.find { |p| p["name"] == "ehime/hello-world" }

expect(updated_dep.dig("extra", "patches_applied"))
.to include("[PATCH] markdown modified")
end
end

context "when testing regression spec for media-organizer" do
let(:project_name) { "media_organizer" }

Expand Down
22 changes: 0 additions & 22 deletions composer/spec/dependabot/composer/update_checker_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -720,28 +720,6 @@
it { is_expected.to be_nil }
end

context "when a sub-dependency would block the update" do
let(:project_name) { "subdependency_update_required" }
let(:dependency_name) { "illuminate/support" }
let(:dependency_version) { "5.2.0" }
let(:requirements) do
[{
file: "composer.json",
requirement: "^5.2.0",
groups: ["runtime"],
source: nil
}]
end

before do
allow(checker).to receive(:latest_version_from_registry)
.and_return(Gem::Version.new("5.6.23"))
end

# 5.5.0 series and up require an update to illuminate/contracts
it { is_expected.to be >= Gem::Version.new("5.6.23") }
end

context "with an invalid composer.json file" do
let(:project_name) { "invalid_manifest" }

Expand Down

0 comments on commit 0bc1852

Please sign in to comment.