Files
rea/tests/boundary/providers/auxiliaryDeclarations.test.ts
T
morluto 63bf91405c refactor!: enforce canonical evidence and provider boundaries
Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership.

Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers.

BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
2026-10-09 20:18:52 +08:00

38 lines
1.4 KiB
TypeScript

import { expect, it } from "vitest";
import { auxiliaryAnalysisProviderDeclarations } from "../../../src/composition/auxiliaryAnalysisProviders.js";
import { LazyAnalysisProvider } from "../../../src/application/binary/LazyAnalysisProvider.js";
import { parseBinaryTarget } from "../../../src/application/BinaryTargetResolver.js";
it("keeps declaration discovery and client creation lazy and independently owned", async () => {
const target = await parseBinaryTarget(process.execPath);
if (!target.ok) throw target.error;
for (const declaration of auxiliaryAnalysisProviderDeclarations({})) {
let loads = 0;
const provider = new LazyAnalysisProvider({
...declaration,
load: async () => {
loads += 1;
return declaration.load();
},
});
expect(provider.identity()).toEqual(declaration.identity);
expect(provider.capabilities()).toEqual(declaration.capabilities);
const client = provider.createClient(target.value);
const unusedClient = provider.createClient(target.value);
await unusedClient.close();
expect(loads).toBe(0);
try {
expect(await client.execute("health", {})).toMatchObject({
ok: true,
value: { provider: declaration.identity },
});
expect(loads).toBe(1);
expect(await client.execute("health", {})).toMatchObject({ ok: true });
expect(loads).toBe(1);
} finally {
await client.close();
}
}
});