Files
reverse-engineering-anything/src/artifacts/pyinstaller/PyInstallerFileAdmission.test.ts
T
morluto 352a846127 test: reduce brittle assertions and test-only runtime paths (#9289)
* test: focus assertions on behavioral evidence

Prune redundant and wording-coupled checks while retaining diagnostic, parser, recovery, and cleanup coverage.

* refactor: remove test-only wrappers and duplicate checks

Exercise production operations through test fixtures, remove unused adapters, and keep managed-member uncertainty guidance under its existing owner.

* test: focus process validation on diagnostic facts

* refactor: remove test-only runtime helpers

Move semantic evidence fixture setup out of runtime and remove unused Windows settle recovery helpers while checking configured defaults independently.

* test: focus artifact diagnostics on format facts

* test: verify retained cleanup guidance delivery
2026-11-08 02:02:31 +08:00

34 lines
1.1 KiB
TypeScript

import { expect, it, vi } from "vitest";
import {
openRegularFile,
RegularFileChangedError,
} from "../../filesystem/RegularFile.js";
import { PyInstallerArtifactReader } from "../PyInstallerArtifactReader.js";
vi.mock("../../filesystem/RegularFile.js", async (importOriginal) => {
const actual =
await importOriginal<typeof import("../../filesystem/RegularFile.js")>();
return { ...actual, openRegularFile: vi.fn(actual.openRegularFile) };
});
it("classifies a source replacement during admission as an integrity failure", async () => {
const path = "/selected/app";
const changed = new RegularFileChangedError(path);
vi.mocked(openRegularFile).mockRejectedValueOnce(changed);
const reader = new PyInstallerArtifactReader(path);
try {
await expect(reader.prepareContainer("0".repeat(64))).rejects.toMatchObject(
{
reason: "integrity",
message: expect.stringContaining(path),
},
);
expect(openRegularFile).toHaveBeenCalledWith(path, {
symlinks: "reject",
signal: expect.any(AbortSignal),
});
} finally {
await reader.close();
}
});