Files
rea/tests/boundary/filesystem/nativeArtifactGoldens.test.ts
T
morlutoandGitHub 4fbc501121 feat(native): add inspection primitives, dispatch traces and approved UI observation (#500)
* fix(hopper): normalize string-backed addresses and update verification

* feat(native): add inspection primitives, dispatch traces and approved UI observation

* test: prioritize real artifact E2E and captured golden regressions

* fix(process): queue observed output before reactive rendering actions

* test: prune redundant cases and strengthen boundary assertions

* fix(cli): route native value tracing through shared workflows

* test: replace synthetic success with real workflows and captured data

* fix(catalog): separate portable metadata from native host availability
2026-10-04 16:02:36 +08:00

55 lines
1.7 KiB
TypeScript

import { readFile } from "node:fs/promises";
import { describe, expect, it } from "vitest";
import { decodeKeyedArchiveBytes } from "../../../src/artifacts/KeyedArchiveReader.js";
import {
parseAppleAssetCatalogRecords,
projectAppleAssetCatalogPage,
} from "../../../src/domain/appleAssetCatalog.js";
const golden = (path: string) =>
new URL(`../../fixtures/golden/${path}`, import.meta.url);
describe("captured Apple artifact goldens", () => {
it("matches the complete Foundation object graph without instantiating its classes", async () => {
const expected: unknown = JSON.parse(
await readFile(golden("keyed-archive/graph.json"), "utf8"),
);
expect(
decodeKeyedArchiveBytes(
await readFile(golden("keyed-archive/foundation.xml")),
{ offset: 0, limit: 20000 },
),
).toEqual(expected);
});
it("preserves every field from captured assetutil output", async () => {
const captured: unknown = JSON.parse(
await readFile(golden("assetutil.json"), "utf8"),
);
const records = parseAppleAssetCatalogRecords(captured);
const page = projectAppleAssetCatalogPage({
targetSha256: "c".repeat(64),
catalogs: [
{
path: "Contents/Resources/Assets.car",
sha256: "a".repeat(64),
records,
},
],
offset: 0,
limit: records.length,
});
expect(page.records.map(({ metadata }) => metadata)).toEqual(captured);
expect(page.records).toContainEqual(
expect.objectContaining({
kind: "rendition",
asset_name: "FixtureColor",
metadata: expect.objectContaining({
AssetType: "Color",
"Color components": [0.125, 0.5, 0.875, 1],
}),
}),
);
});
});