Files
reverse-engineering-anything/src/domain/browserNetworkEvidence.test.ts
T
morluto 392f1f3107 refactor: consolidate boundary semantics and prune redundant tests
Share parser modes and collision-free composite keys, enforce architecture guards, and consolidate redundant unit assertions into filesystem, CLI, MCP, and producer-backed workflows. Preserve concurrent upstream boundary fixes and exclude legacy Objective-C class-name bookkeeping labels.

Validation: source/composition suites (3358 passing), focused canonical digest and MCP checks, typecheck/lint, Knip, formatting, architecture guards, and real Foundation archive and Apple legacy simulator CLI/MCP verification. No real Hopper, Ghidra, or IDA verification claim.
2026-10-10 05:56:01 +08:00

29 lines
882 B
TypeScript

import { createHash } from "node:crypto";
import { expect, it } from "vitest";
import { browserNetworkBodySchema } from "./browserNetworkEvidence.js";
const bytes = Buffer.from([0xff, 0, 0xfe]);
const retained = {
state: "captured",
representation: "browser-decoded-response-bytes",
encoding: "base64",
content: bytes.toString("base64"),
bytes: bytes.length,
sha256: createHash("sha256").update(bytes).digest("hex"),
media_type: null,
redacted: false,
};
it("validates the actual retained bytes against canonical base64, count, and digest", () => {
expect(browserNetworkBodySchema.safeParse(retained).success).toBe(true);
for (const mutation of [
{ bytes: 4 },
{ sha256: "0".repeat(64) },
{ content: `${retained.content}\n` },
])
expect(
browserNetworkBodySchema.safeParse({ ...retained, ...mutation }).success,
).toBe(false);
});