Qualifiers are a map of string key-value pairs

This commit is contained in:
Lane Seppala
2023-06-02 15:24:39 +00:00
parent 5a8ce4ad8c
commit 83edbc93dd
5 changed files with 40 additions and 15 deletions
+27 -8
View File
@@ -1,20 +1,39 @@
import ComponentDetection from './componentDetection';
import fs from 'fs';
import ComponentDetection from "./componentDetection";
import fs from "fs";
test('Downloads CLI', async () => {
test("Downloads CLI", async () => {
await ComponentDetection.downloadLatestRelease();
expect(fs.existsSync(ComponentDetection.componentDetectionPath));
});
test('Runs CLI', async () => {
test("Runs CLI", async () => {
await ComponentDetection.downloadLatestRelease();
await ComponentDetection.runComponentDetection('./test');
await ComponentDetection.runComponentDetection("./test");
expect(fs.existsSync(ComponentDetection.outputPath));
});
test('Parses CLI output', async () => {
test("Parses CLI output", async () => {
await ComponentDetection.downloadLatestRelease();
await ComponentDetection.runComponentDetection('./test');
await ComponentDetection.runComponentDetection("./test");
var manifests = await ComponentDetection.getManifestsFromResults();
expect(manifests?.length == 2);
});
});
describe("ComponentDetection.makePackageUrl", () => {
test("returns a valid package url", () => {
const packageUrl = ComponentDetection.makePackageUrl({
Scheme: "pkg",
Type: "npm",
Namespace: "github",
Name: "component-detection-action",
Version: "0.0.2",
Qualifiers: {
arch: "amd64",
os: "linux",
},
});
expect(packageUrl).toBe(
"pkg:npm/github/[email protected]?arch=amd64&os=linux"
);
});
});