Skip to content

Commit

Permalink
adding create_dependency to spec helper
Browse files Browse the repository at this point in the history
  • Loading branch information
robaiken committed Jan 29, 2025
1 parent 6205232 commit 1772e0e
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 355 deletions.
20 changes: 20 additions & 0 deletions common/spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,23 @@ def initialize(constraint_string)
super(requirements)
end
end

def create_dependency(name:, version:, required_version:, previous_required_version:)
Dependabot::Dependency.new(
name: name,
version: version,
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: required_version,
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: previous_required_version,
groups: [],
source: nil
}]
)
end
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,11 @@

let(:dependencies) { [dependency] }
let(:dependency) do
Dependabot::Dependency.new(
create_dependency(
name: "prettier",
version: "3.3.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "3.3.3",
groups: ["dependencies"],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "3.3.0",
groups: ["dependencies"],
source: nil
}]
required_version: "3.3.3",
previous_required_version: "3.3.0"
)
end

Expand All @@ -50,39 +39,17 @@
let(:project_name) { "pnpm/catalog_multiple" }
let(:dependencies) do
[
Dependabot::Dependency.new(
create_dependency(
name: "prettier",
version: "3.3.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^3.3.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^3.3.0",
groups: [],
source: nil
}]
required_version: "^3.3.3",
previous_required_version: "^3.3.0"
),
Dependabot::Dependency.new(
create_dependency(
name: "left-pad",
version: "1.0.1",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^1.0.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^1.0.1",
groups: [],
source: nil
}]
required_version: "^1.0.3",
previous_required_version: "^1.0.1"
)
]
end
Expand All @@ -95,39 +62,17 @@
let(:project_name) { "pnpm/catalogs_react" }
let(:dependencies) do
[
Dependabot::Dependency.new(
create_dependency(
name: "react",
version: "18.0.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.2.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.0.0",
groups: [],
source: nil
}]
required_version: "^18.2.3",
previous_required_version: "^18.0.0"
),
Dependabot::Dependency.new(
create_dependency(
name: "react-dom",
version: "18.0.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.2.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.0.0",
groups: [],
source: nil
}]
required_version: "^18.2.3",
previous_required_version: "^18.0.0"
)
]
end
Expand All @@ -140,73 +85,29 @@
let(:project_name) { "pnpm/catalogs_multiple_reacts" }
let(:dependencies) do
[
Dependabot::Dependency.new(
create_dependency(
name: "react",
version: "18.0.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.2.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.0.0",
groups: [],
source: nil
}]
required_version: "^18.2.3",
previous_required_version: "^18.0.0"
),
Dependabot::Dependency.new(
create_dependency(
name: "react-dom",
version: "18.0.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.2.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.0.0",
groups: [],
source: nil
}]
required_version: "^18.2.3",
previous_required_version: "^18.0.0"
),
Dependabot::Dependency.new(
create_dependency(
name: "react",
version: "16.0.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^16.2.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^16.0.0",
groups: [],
source: nil
}]
required_version: "^16.2.3",
previous_required_version: "^16.0.0"
),
Dependabot::Dependency.new(
create_dependency(
name: "react-dom",
version: "16.0.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^16.2.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^16.0.0",
groups: [],
source: nil
}]
required_version: "^16.2.3",
previous_required_version: "^16.0.0"
)
]
end
Expand All @@ -222,90 +123,35 @@
let(:project_name) { "pnpm/catalogs_valid_yaml" }
let(:dependencies) do
[
Dependabot::Dependency.new(
create_dependency(
name: "prettier",
version: "3.3.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "3.3.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "3.3.0",
groups: [],
source: nil
}]
required_version: "3.3.3",
previous_required_version: "3.3.0"
),
Dependabot::Dependency.new(
create_dependency(
name: "express",
version: "4.15.2",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "4.21.2",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "4.15.2",
groups: [],
source: nil
}]
required_version: "4.21.2",
previous_required_version: "4.15.2"
),
Dependabot::Dependency.new(
create_dependency(
name: "is-even",
version: "0.1.2",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "1.0.0",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "0.1.2",
groups: [],
source: nil
}]
required_version: "1.0.0",
previous_required_version: "0.1.2"
),
Dependabot::Dependency.new(
create_dependency(
name: "react",
version: "18.0.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.2.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.0.0",
groups: [],
source: nil
}]
required_version: "^18.2.3",
previous_required_version: "^18.0.0"
),
Dependabot::Dependency.new(
create_dependency(
name: "react-dom",
version: "18.0.0",
package_manager: "npm_and_yarn",
requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.2.3",
groups: [],
source: nil
}],
previous_requirements: [{
file: "pnpm-workspace.yaml",
requirement: "^18.0.0",
groups: [],
source: nil
}]
required_version: "^18.2.3",
previous_required_version: "^18.0.0"
)
]
end
Expand Down
Loading

0 comments on commit 1772e0e

Please sign in to comment.