test(native): consolidate keyed archive scalar journeys (#12799)

test(artifacts): consolidate keyed archive scalar delivery coverage
This commit is contained in:
morluto authored and GitHub committed 2026-11-20 12:42:22 +00:00
1 parent fce34706dd
commit 7f411078a3
1 file changed
+20 -21
@@ -10,7 +10,7 @@ import { parseEvidence } from "../../../src/domain/evidence.js";
import { createTestTempDirectory } from "../../fixtures/temporaryDirectory.js";
import { cliTest } from "../../support/cli/cliFixture.js";
cliTest.for([
const scalars = [
{ name: "plain real", element: "<real>1.25</real>", expected: 1.25 },
{
name: "mixed real",
@@ -58,17 +58,20 @@ cliTest.for([
element: "<data>&amp;AQID</data>",
expected: { $plist_type: "data", base64: "ampA" },
},
])(
"preserves $name XML scalars through CLI and MCP",
async (scenario, { cli }) => {
];
cliTest(
"preserves XML scalar variants through CLI and MCP",
async ({ cli }) => {
const root = await createTestTempDirectory("rea-keyed-xml-numbers-");
const elements = scalars.map(({ element }) => element).join("");
const bytes = Buffer.from(
build({
$archiver: "NSKeyedArchiver",
$version: 100000,
$objects: ["$null", "__VALUE__"],
$objects: ["$null", "__SCALARS__"],
$top: { root: { CF$UID: 1 } },
}).replace("<string>__VALUE__</string>", scenario.element),
}).replace("<string>__SCALARS__</string>", elements),
);
const path = join(root, "archive.plist");
await writeFile(path, bytes);
@@ -83,7 +86,7 @@ cliTest.for([
"--offset",
"1",
"--limit",
"1",
String(scalars.length),
"--json",
],
environment: { REA_LOG_LEVEL: "silent" },
@@ -96,7 +99,7 @@ cliTest.for([
const mcp = await call("inspect_keyed_archive", {
root: "root",
offset: 1,
limit: 1,
limit: scalars.length,
});
expect(mcp.isError, JSON.stringify(mcp)).not.toBe(true);
expect(
@@ -107,23 +110,19 @@ cliTest.for([
expect(result.archive_sha256).toBe(
createHash("sha256").update(bytes).digest("hex"),
);
expect(result.objects).toEqual([
{
id: 1,
expect(result.objects).toHaveLength(scalars.length);
for (const [index, scalar] of scalars.entries()) {
expect(result.objects[index], scalar.name).toEqual({
id: index + 1,
kind: "scalar",
class_id: null,
class_name: null,
status: "observed",
value: scenario.expected,
},
]);
expect(result.references).toEqual([
expect.objectContaining({
source: null,
path: ["root"],
target: 1,
status: "resolved",
}),
value: scalar.expected,
});
}
expect(result.references).toMatchObject([
{ source: null, path: ["root"], target: 1, status: "resolved" },
]);
expect(
result.limitations.some((note) =>