test(artifacts): consolidate selected name and admitted content coverage (#12880)

This commit is contained in:
morluto authored and GitHub committed 2026-11-20 16:12:58 +00:00
1 parent 79bd830f4e
commit fdbe6d5f2b
2 files changed
+4 -7

No files matched your search

@@ -119,13 +119,12 @@ it.skipIf(process.platform === "win32")(
);
it.each([
{ format: "zip", replacement: "valid" },
{ format: "apk", replacement: "valid" },
{ format: "asar", replacement: "valid" },
{ format: "zip", replacement: "malformed" },
{ format: "asar", replacement: "malformed" },
])(
"binds $format $replacement archive operations to the admitted source before output creation",
"rejects $format $replacement replacements without publishing extracted files",
async ({ format, replacement }) => {
const root = await createTestTempDirectory(
"rea-archive-admitted-identity-",
@@ -152,12 +151,12 @@ it.each([
if (!initial.ok) throw initial.error;
if (replacement === "malformed") await writeFile(path, "not an archive");
else await writeArchive("changed version two");
const output = join(root, "refused-extraction");
for (const operation of [
"inventory_artifact",
"inspect_artifact",
"extract_artifact",
] as const) {
const output = join(root, `refused-${operation}`);
const result = await session.execute(
operation,
operation === "extract_artifact"
@@ -171,8 +170,8 @@ it.each([
integrityCheck: "container-identity",
},
});
await expect(access(output)).rejects.toMatchObject({ code: "ENOENT" });
}
await expect(access(output)).rejects.toMatchObject({ code: "ENOENT" });
if (replacement === "valid") {
const reopened = await session.open(path);
if (!reopened.ok) throw reopened.error;
@@ -31,8 +31,6 @@ const fixture = async (storedName = "content-addressed-archive") => {
};
it.skipIf(process.platform === "win32").each([
["selected.apk", "content", "apk"],
["selected.ipa", "content", "ipa"],
["selected.apk", "canonical.ipa", "apk"],
["selected.ipa", "canonical.apk", "ipa"],
["selected.unknown", "canonical.apk", "apk"],
@@ -75,7 +73,7 @@ it.skipIf(process.platform === "win32").each([
await readFile(join(result.output_root, "payload.txt"), "utf8"),
).toBe("same packed bytes");
} finally {
await client.close();
expect(await client.close()).toEqual({ ok: true, value: null });
}
},
);