Defensively guard against dangling ? from qualifiers
This commit is contained in:
@@ -20,7 +20,7 @@ test("Parses CLI output", async () => {
|
||||
});
|
||||
|
||||
describe("ComponentDetection.makePackageUrl", () => {
|
||||
test("returns a valid package url", () => {
|
||||
test("returns a valid package url from saturated object", () => {
|
||||
const packageUrl = ComponentDetection.makePackageUrl({
|
||||
Scheme: "pkg",
|
||||
Type: "npm",
|
||||
@@ -36,4 +36,18 @@ describe("ComponentDetection.makePackageUrl", () => {
|
||||
"pkg:npm/github/[email protected]?arch=amd64&os=linux"
|
||||
);
|
||||
});
|
||||
|
||||
test("returns valid package url without dangling ? with empty qualifers", () => {
|
||||
const packageUrl = ComponentDetection.makePackageUrl({
|
||||
Scheme: "pkg",
|
||||
Type: "npm",
|
||||
Namespace: "github",
|
||||
Name: "component-detection-action",
|
||||
Version: "0.0.2",
|
||||
Qualifiers: { },
|
||||
});
|
||||
expect(packageUrl).toBe(
|
||||
"pkg:npm/github/[email protected]"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user