refactor(deno): share extracted text assertions in verifier (#16151)

This commit is contained in:
Vincent Koc
2026-12-03 00:11:23 +00:00
committed by GitHub
parent 3ccf2532f9
commit b29d9d0a43
+12 -29
View File
@@ -100,6 +100,13 @@ const member = (graph, suffix) =>
row.format_metadata.source_path?.endsWith(`/${suffix}`)),
);
const assertExtractedText = async (extraction, entry, expected) => {
assert.equal(
await readFile(join(extraction.output_root, entry.logical_path), "utf8"),
expected,
);
};
await withVerifierFixture(root, async () => {
const app = join(root.path, "main.ts");
const asset = join(root.path, "asset.txt");
@@ -160,21 +167,9 @@ await withVerifierFixture(root, async () => {
await cli(["extract-artifact", hostOutput, "--json"]),
).normalized_result;
assert.equal(extracted.containment_verified, true);
assert.equal(
await readFile(join(extracted.output_root, main.logical_path), "utf8"),
sourceText,
);
assert.equal(
await readFile(
join(extracted.output_root, storedAsset.logical_path),
"utf8",
),
assetText,
);
assert.equal(
await readFile(join(extracted.output_root, long.logical_path), "utf8"),
longModuleText,
);
await assertExtractedText(extracted, main, sourceText);
await assertExtractedText(extracted, storedAsset, assetText);
await assertExtractedText(extracted, long, longModuleText);
const transpiledLong = await readFile(
join(extracted.output_root, `${long.logical_path}.deno-transpiled`),
"utf8",
@@ -223,20 +218,8 @@ await withVerifierFixture(root, async () => {
const crossExtracted = parseEvidence(
await cli(["extract-artifact", output, "--json"]),
).normalized_result;
assert.equal(
await readFile(
join(crossExtracted.output_root, crossMain.logical_path),
"utf8",
),
sourceText,
);
assert.equal(
await readFile(
join(crossExtracted.output_root, crossAsset.logical_path),
"utf8",
),
assetText,
);
await assertExtractedText(crossExtracted, crossMain, sourceText);
await assertExtractedText(crossExtracted, crossAsset, assetText);
if (carrier === "elf") {
// An unparseable note table with no confirmed SUI note stays native.
const image = await readFile(output);