test: add limit monotonicity and partial-evidence regressions

This commit is contained in:
N0zoM1z0
2026-07-17 22:22:02 +08:00
parent 9a92a7958c
commit 4afd97029c
2 changed files with 280 additions and 4 deletions
+20 -4
View File
@@ -365,10 +365,14 @@ describe("JavaScript artifact reconstruction", () => {
const root = await mkdtemp(join(tmpdir(), "rea-javascript-ast-limit-"));
await writeFile(
join(root, "large.js"),
Array.from(
{ length: 100 },
(_, index) => `export const value${String(index)} = ${String(index)};`,
).join("\n"),
[
'import "./unobserved.js";',
...Array.from(
{ length: 100 },
(_, index) =>
`export const value${String(index)} = ${String(index)};`,
),
].join("\n"),
);
const result = await reconstructJavaScriptArtifact({
@@ -383,6 +387,18 @@ describe("JavaScript artifact reconstruction", () => {
truncated: true,
omitted_count: null,
});
const derivedImport = result.graph.edges.find(
({ relation, properties }) =>
relation === "imports" && properties.specifier === "./unobserved.js",
);
expect(derivedImport?.evidence.coverage).toEqual({
status: "partial",
truncated: true,
omitted_count: null,
limits: expect.arrayContaining([
{ name: "max-ast-nodes", value: 50, unit: "items" },
]),
});
});
it("does not follow symlinks or read oversized JavaScript text", async () => {