Files
morluto 60149282fc test: strengthen integration oracles and verification (#8295)
* test: strengthen integration oracles and verification

* test: bound lifecycle gates and strengthen workflow checks

* test: verify complete paged and extracted results

* test: preserve bytecode and cancellation evidence

* test: strengthen retained evidence and fixture cleanup

* test: require cross-projection bridge identities

* test: retain fixture owners through cleanup failures

* test: verify graph examples and project selectors

* test: tighten provider and lifecycle regressions

* test: consolidate hex coverage and bound cutter cleanup

* test: bound subprocess output waits and strengthen graph checks

* test: check mcp recovery and preserve cleanup owners

* test: verify structured mcp argument failures

* test: preserve artifact cleanup and gdb limit evidence

* test: preserve evidence identities and bound provider gates

* test: retain browser and comparison cleanup owners

* test: bound startup and strengthen fixture oracles

* test: bound lifecycle gates and verify recovered evidence

* test: verify public outcomes and lifecycle ownership

* test: assert precise evidence and release lifecycle gates

* test: verify selected facts and bound cleanup waits

* test: check retained evidence and decoded records

* test: verify final reports and retain cleanup ownership

* test: bound reviewed startup gates and retain cleanup

* test: verify PE errors and preserve MCP cleanup

* test: preserve MCP fixture cleanup ownership

* test: release provider gates before late startup
2026-11-01 00:15:28 +08:00

74 lines
2.6 KiB
TypeScript

import { readFile, writeFile } from "node:fs/promises";
import { join } from "node:path";
import { expect } from "vitest";
import { webScriptExportManifestSchema } from "../../../src/domain/webScriptExport.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import { scriptScenarioFixture } from "../../fixtures/webScriptCapture.js";
import { cliTest } from "../../support/cli/cliFixture.js";
import { analyzeJavaScriptDirectory } from "../../support/cli/javascriptApplication.js";
cliTest(
"keeps portable URL characters in exported module relationships",
async ({ cli }) => {
const root = await createTestTempDirectory("rea-web-script-portable-");
const capturePath = join(root, "capture.json");
const output = join(root, "output");
const filenames = ["chunk+abc.js", "cash$flow.js", "a&b.js"];
const scripts = [
{
url: "https://fixture.test/app/main.js",
bytes: Buffer.from(
filenames.map((name) => `import './${name}';`).join("\n"),
),
},
...filenames.map((name) => ({
url: `https://fixture.test/app/${name}`,
bytes: Buffer.from("export const marker = 1;\n"),
})),
];
await writeFile(
capturePath,
JSON.stringify(scriptScenarioFixture(scripts)),
);
const published = await cli.run({
arguments: ["export-web-scripts", capturePath, output, "--json"],
});
expect(published.exitCode, published.stderr).toBe(0);
const manifest = webScriptExportManifestSchema.parse(
JSON.parse(await readFile(join(output, "manifest.json"), "utf8")),
);
expect(manifest.scripts.map(({ url }) => url)).toEqual(
scripts.map(({ url }) => url),
);
for (const [index, record] of manifest.scripts.entries()) {
expect(record.content.state).toBe("exported");
if (record.content.state !== "exported")
throw new Error("missing export");
expect(record.content.layout).toBe("url-path");
const expected = scripts[index]?.bytes;
if (expected === undefined) throw new Error("missing source script");
expect(
(
await readFile(join(output, "files", record.content.relative_path))
).equals(expected),
).toBe(true);
}
const result = await analyzeJavaScriptDirectory(
"CLI",
cli,
join(output, "files"),
);
for (const name of filenames)
expect(result.graph.edges).toContainEqual(
expect.objectContaining({
relation: "imports",
properties: expect.objectContaining({
specifier: `./${name}`,
resolution_status: "resolved",
}),
}),
);
},
);