Files
reverse-engineering-anything/tests/fixtures/fakeHopperReplies.d.mts
T
morluto 2237f936f0 fix(test): serve fake Hopper segments in the bridge's reply contract (#10734)
* fix(test): serve fake Hopper segments in the bridge's reply contract

#10662 validates every Hopper bridge reply. The fake Hopper behind the darwin packaged-CLI baseline still served list_segments without permissions, provenance and sections, so 'rea analyze --provider hopper' failed as unreadable output on every PR that ran that lane. The fixture's replies move to fakeHopperReplies.mjs, list_segments takes the real bridge's shape, and a test checks every served reply against the contract table.

* test(hopper): derive the fake reply method list from one keyed factory object

The contract test iterated a hand-kept method list beside the reply switch, so
a reply added without updating the list would go unchecked. Replies are now
factories in one keyed object; fakeHopperReply looks them up by key and
FAKE_HOPPER_REPLY_METHODS is the object's keys, so every served reply is
validated against its contract.

* test(hopper): serve containing-procedure and reference replies from the keyed factories
2026-11-15 13:54:20 +08:00

14 lines
494 B
TypeScript

import type { JsonValue } from "../../src/domain/jsonValue.js";
/** Successful bridge replies the fake Hopper serves, keyed by method. */
export const FAKE_HOPPER_REPLIES: Readonly<
Record<string, (params?: Readonly<Record<string, JsonValue>>) => JsonValue>
>;
export function fakeHopperReply(
method: string,
params?: Readonly<Record<string, JsonValue>>,
): JsonValue | undefined;
/** Every method fakeHopperReply answers. */
export const FAKE_HOPPER_REPLY_METHODS: readonly string[];