-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store Language Name, Version, and Requirements for
npm
, pnpm
, and…
… `yarn` (#11017)
- Loading branch information
Showing
6 changed files
with
270 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
npm_and_yarn/spec/dependabot/npm_and_yarn/language_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# typed: false | ||
# frozen_string_literal: true | ||
|
||
require "dependabot/ecosystem" | ||
require "dependabot/npm_and_yarn/package_manager" | ||
require "spec_helper" | ||
|
||
RSpec.describe Dependabot::NpmAndYarn::Language do | ||
let(:language) { described_class.new(raw_version, requirement: requirement) } | ||
let(:raw_version) { "16.13.1" } | ||
let(:requirement) { nil } | ||
|
||
describe "#initialize" do | ||
it "sets the version correctly" do | ||
expect(language.version).to eq(Dependabot::Version.new(raw_version)) | ||
end | ||
|
||
it "sets the name correctly" do | ||
expect(language.name).to eq(Dependabot::NpmAndYarn::Language::NAME) | ||
end | ||
|
||
it "sets the deprecated_versions correctly" do | ||
expect(language.deprecated_versions).to eq(Dependabot::NpmAndYarn::Language::DEPRECATED_VERSIONS) | ||
end | ||
|
||
it "sets the supported_versions correctly" do | ||
expect(language.supported_versions).to eq(Dependabot::NpmAndYarn::Language::SUPPORTED_VERSIONS) | ||
end | ||
|
||
context "when a requirement is provided" do | ||
let(:requirement) { Dependabot::NpmAndYarn::Requirement.new([">= 16.0.0", "< 17.0.0"]) } | ||
|
||
it "sets the requirement correctly" do | ||
expect(language.requirement).to eq(requirement) | ||
end | ||
end | ||
end | ||
|
||
describe "#deprecated?" do | ||
it "returns false by default" do | ||
expect(language.deprecated?).to be false | ||
end | ||
end | ||
|
||
describe "#unsupported?" do | ||
it "returns false by default" do | ||
expect(language.unsupported?).to be false | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters