refactor(catalog): import CLI metadata from its owner
This commit is contained in:
@@ -3,7 +3,7 @@ import { Cli, z } from "incur";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createCli } from "../../../src/cli.js";
|
||||
import { createCliInventory } from "../../../scripts/lib/product-catalog.mjs";
|
||||
import { createCliInventory } from "../../../scripts/lib/catalog-cli.mjs";
|
||||
|
||||
type CliInstance = ReturnType<typeof createCli>;
|
||||
type CommandMap = NonNullable<ReturnType<typeof Cli.toCommands.get>>;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createCli } from "../../../src/cli.js";
|
||||
import { createCliInventory } from "../../../scripts/lib/product-catalog.mjs";
|
||||
import { createCliInventory } from "../../../scripts/lib/catalog-cli.mjs";
|
||||
import { TOOL_CONTRACTS } from "../../../src/contracts/toolContracts.js";
|
||||
import {
|
||||
CLI_COMMAND_ALIASES,
|
||||
|
||||
@@ -27,8 +27,9 @@ import {
|
||||
createCliInventory,
|
||||
cliCommandDescriptionIssues,
|
||||
cliCommandOptionNames,
|
||||
} from "../../../scripts/lib/catalog-cli.mjs";
|
||||
import {
|
||||
createProductCatalog,
|
||||
providerCatalogDigest,
|
||||
serializeProductCatalog,
|
||||
} from "../../../scripts/lib/product-catalog.mjs";
|
||||
|
||||
@@ -77,9 +78,6 @@ describe("canonical product catalog", () => {
|
||||
catalog.providers.find(({ id }) => id === GHIDRA_PROVIDER_IDENTITY.id)
|
||||
?.capabilities,
|
||||
).toEqual([...GHIDRA_OPERATIONS].sort());
|
||||
expect(catalog.runtime_catalog.digests.providers_sha256).toBe(
|
||||
providerCatalogDigest(catalog.providers),
|
||||
);
|
||||
expect(
|
||||
JSON.parse(await readFile("docs/public/product-catalog.json", "utf8")),
|
||||
).toEqual(catalog);
|
||||
@@ -207,19 +205,6 @@ describe("canonical product catalog drift", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("changes the provider projection digest when provider facts drift", async () => {
|
||||
const catalog = await createProductCatalog(root);
|
||||
const firstProvider = catalog.providers[0];
|
||||
if (firstProvider === undefined) throw new TypeError("Missing provider");
|
||||
const driftedProviders = [
|
||||
{ ...firstProvider, name: `${firstProvider.name} drifted` },
|
||||
...catalog.providers.slice(1),
|
||||
];
|
||||
expect(providerCatalogDigest(driftedProviders)).not.toBe(
|
||||
catalog.runtime_catalog.digests.providers_sha256,
|
||||
);
|
||||
});
|
||||
|
||||
it("fails check mode without rewriting a stale generated artifact", async () => {
|
||||
const directory = await createTestTempDirectory("rea-generated-check-");
|
||||
temporaryRoots.push(directory);
|
||||
|
||||
Reference in New Issue
Block a user