Skip to content

Commit

Permalink
test: parse 'package.json' files with non-standard fields in author s…
Browse files Browse the repository at this point in the history
…ection

Signed-off-by: Piotr Radkowski <piotr.radkowski@contractors.roche.com>
  • Loading branch information
Piotr Radkowski committed Oct 7, 2024
1 parent 28ba7a3 commit b713c5b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
21 changes: 21 additions & 0 deletions syft/pkg/cataloger/javascript/parse_package_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,27 @@ func TestParsePackageJSON(t *testing.T) {
},
},
},
{
Fixture: "test-fixtures/pkg-json/package-author-non-standard.json",
ExpectedPkg: pkg.Package{
Name: "npm",
Version: "6.14.6",
PURL: "pkg:npm/npm@6.14.6",
Type: pkg.NpmPkg,
Licenses: pkg.NewLicenseSet(
pkg.NewLicenseFromLocations("Artistic-2.0", file.NewLocation("test-fixtures/pkg-json/package-author-non-standard.json")),
),
Language: pkg.JavaScript,
Metadata: pkg.NpmPackage{
Name: "npm",
Version: "6.14.6",
Author: "npm Inc. (https://www.npmjs.com/)",
Homepage: "https://docs.npmjs.com/",
URL: "https://github.com/npm/cli",
Description: "a package manager for JavaScript",
},
},
},
}

for _, test := range tests {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "6.14.6",
"name": "npm",
"description": "a package manager for JavaScript",
"homepage": "https://docs.npmjs.com/",
"author": {
"name": "npm Inc.",
"url": "https://www.npmjs.com/",
"organization": true
},
"repository": {
"type": "git",
"url": "https://github.com/npm/cli"
},
"license": "Artistic-2.0"
}

0 comments on commit b713c5b

Please # to comment.