Files
reverse-engineering-anything/src/domain/apple/machoEncryption.test.ts
T
morlutoandCursor Agent 5821506eb2 fix(native): preserve Mach-O source and decode facts (#9902)
* fix(native): retain Mach-O file identity through completion

* fix(native): distinguish malformed Mach-O encryption facts

* fix(native): preserve Mach-O command and dylib coverage

* fix(native): preserve Apple dispatch fixup and declaration facts

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
2026-11-10 22:50:26 -05:00

38 lines
958 B
TypeScript

import { expect, it } from "vitest";
import { machoSliceEncryptionSchema } from "./machoEncryption.js";
it("requires a malformed cause exactly for malformed slice encryption", () => {
const slice = {
architecture: null,
cpu_type: null,
cpu_subtype: null,
container_file_offset: 0,
size: 32,
reason: null,
commands: [],
range: null,
};
for (const status of [
"absent",
"encrypted",
"not-encrypted",
"unknown",
"malformed",
]) {
for (const malformed_kind of [null, "structure", "duplicate-commands"]) {
expect(
machoSliceEncryptionSchema.safeParse({
...slice,
status,
malformed_kind,
}).success,
`${status}/${String(malformed_kind)}`,
).toBe((status === "malformed") === (malformed_kind !== null));
}
}
expect(
machoSliceEncryptionSchema.safeParse({ ...slice, status: "absent" })
.success,
).toBe(false);
});