mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 17:23:37 +08:00
refactor(deno): share extracted text assertions in verifier (#16151)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user