test: prune redundant and implementation-coupled coverage

This commit is contained in:
morluto committed 2026-11-17 18:48:24 -05:00
1 parent 14b15ba8a5
commit 48e27e19b7
191 files changed
+2757 -5418

No files matched your search

+24 -54
View File
@@ -1,62 +1,32 @@
import { expect, expectTypeOf, it, vi } from "vitest";
import { z } from "zod";
import { expect, it } from "vitest";
import { join } from "node:path";
import { evmInterfaceModule } from "../../src/composition/evm.js";
import { wasmArtifactModule } from "../../src/composition/wasm.js";
import { cliCommandFor } from "../../src/contracts/cliCommandNames.js";
import { INSPECT_EVM_INTERFACE_CONTRACT } from "../../src/contracts/evm/evmToolContracts.js";
import { createTestTempDirectory } from "../fixtures/temporaryDirectory.js";
it("rejects incompatible static bindings through the complete project typecheck", () => {
// expect-type's negative assertions are checked by tsc, not the runtime
// test runner. No malformed descriptor is registered or executed here.
expectTypeOf({
...evmInterfaceModule,
contract: wasmArtifactModule.contract,
}).not.toExtend<typeof evmInterfaceModule>();
expectTypeOf({
...evmInterfaceModule,
cliCommand: cliCommandFor("inspect_wasm_artifact"),
}).not.toExtend<typeof evmInterfaceModule>();
expectTypeOf({
...evmInterfaceModule,
create: wasmArtifactModule.create,
}).not.toExtend<typeof evmInterfaceModule>();
expectTypeOf({
...evmInterfaceModule,
contract: {
...evmInterfaceModule.contract,
inputSchema: z.strictObject({ unrelated: z.string() }),
},
}).not.toExtend<typeof evmInterfaceModule>();
expectTypeOf({
...evmInterfaceModule,
contract: {
...evmInterfaceModule.contract,
outputSchema: z.strictObject({ unrelated: z.string() }),
},
}).not.toExtend<typeof evmInterfaceModule>();
});
it("keeps the named binding and gives each caller a separate lazy service owner", async () => {
expect(evmInterfaceModule.contract).toBe(INSPECT_EVM_INTERFACE_CONTRACT);
expect(evmInterfaceModule.cliCommand).toBe(
cliCommandFor("inspect_evm_interface"),
);
const first = evmInterfaceModule.create({});
const second = evmInterfaceModule.create({});
it("keeps one EVM inspection service available to admit requests after another closes", async () => {
const directory = await createTestTempDirectory("rea-evm-services-");
const input = { path: join(directory, "fixture.hex"), encoding: "hex" };
const host = { platform: "darwin", architecture: "arm64" } as const;
const first = evmInterfaceModule.create({}, host);
const second = evmInterfaceModule.create({}, host);
try {
expect(first).not.toBe(second);
expect(first.provider).not.toBe(second.provider);
await first.close();
const inspect = vi.spyOn(second.provider, "inspect");
const invalid = await second.inspect({
path: "relative.hex",
encoding: "hex",
});
expect(invalid).toMatchObject({
const beforeClose = await second.inspect(input);
expect(beforeClose).toMatchObject({
ok: false,
error: { _tag: "AnalysisInputError" },
error: {
_tag: "AnalysisCapabilityUnavailableError",
reason: expect.stringContaining("Linux x64"),
},
});
expect(inspect).not.toHaveBeenCalled();
await first.close();
expect(await first.inspect(input)).toMatchObject({
ok: false,
error: {
_tag: "AnalysisCapabilityUnavailableError",
reason: expect.stringContaining("closing"),
},
});
expect(await second.inspect(input)).toEqual(beforeClose);
} finally {
await first.close();
await second.close();