mirror of
https://github.com/bitbaum/fleet.git
synced 2026-12-04 07:57:55 +01:00
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import { test } from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { manifestPaths } from "./shared-registry-audit.mjs";
|
|
test("discover nested apps, local packages, examples and generated starter sources", () => {
|
|
const paths = [
|
|
"package.json",
|
|
"templates/app/package.json",
|
|
"apps/studio/package.json",
|
|
"packages/tax-model/package.json",
|
|
"examples/next/package.json",
|
|
"frontend/package.json",
|
|
];
|
|
assert.deepEqual(
|
|
manifestPaths({ tree: paths.map((path) => ({ path, type: "blob" })) }),
|
|
paths.sort(),
|
|
);
|
|
});
|
|
test("ignore installed/generated manifests, fixtures and directories", () => {
|
|
const paths = [
|
|
"node_modules/a/package.json",
|
|
"dist/package.json",
|
|
".next/package.json",
|
|
"test/fixtures/package.json",
|
|
"test/__fixtures__/a/package.json",
|
|
"coverage/package.json",
|
|
];
|
|
assert.deepEqual(
|
|
manifestPaths({
|
|
tree: [
|
|
...paths.map((path) => ({ path, type: "blob" })),
|
|
{ path: "package.json", type: "tree" },
|
|
],
|
|
}),
|
|
[],
|
|
);
|
|
});
|
|
test("a truncated or unavailable tree cannot publish complete-looking facts", () => {
|
|
assert.throws(
|
|
() => manifestPaths({ truncated: true, tree: [] }),
|
|
/incomplete/,
|
|
);
|
|
assert.throws(() => manifestPaths({}), /unavailable/);
|
|
});
|