MCPcopy Create free account
hub / github.com/EvoMap/evolver / makeMockSdk

Function makeMockSdk

test/proxyBedrock.test.js:13–38  ·  view source on GitHub ↗
(handlers)

Source from the content-addressed store, hash-verified

11// event-stream binary fixtures (which require internal smithy modules
12// that are deep transitive deps).
13function makeMockSdk(handlers) {
14 let lastClientArgs = null;
15 let lastCommand = null;
16
17 class MockBedrockRuntimeClient {
18 constructor(args) { lastClientArgs = args; }
19 async send(command) {
20 lastCommand = command;
21 const isStream = command instanceof MockInvokeModelWithResponseStreamCommand;
22 return isStream
23 ? handlers.stream(command.input)
24 : handlers.invoke(command.input);
25 }
26 }
27 class MockInvokeModelCommand { constructor(input) { this.input = input; } }
28 class MockInvokeModelWithResponseStreamCommand { constructor(input) { this.input = input; } }
29
30 return {
31 sdk: {
32 BedrockRuntimeClient: MockBedrockRuntimeClient,
33 InvokeModelCommand: MockInvokeModelCommand,
34 InvokeModelWithResponseStreamCommand: MockInvokeModelWithResponseStreamCommand,
35 },
36 inspect: () => ({ lastClientArgs, lastCommand }),
37 };
38}
39
40async function readSseStream(stream) {
41 const reader = stream.getReader();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected