MCPcopy Create free account
hub / github.com/Noumena-Network/code / buildMockedSubmit

Function buildMockedSubmit

src/utils/handlePromptSubmit.submit.test.ts:9–44  ·  view source on GitHub ↗
(env?: {
  processUserInputReturn?: Awaited<
    ReturnType<typeof import('./processUserInput/processUserInput.js').processUserInput>
  >
})

Source from the content-addressed store, hash-verified

7})
8
9async function buildMockedSubmit(env?: {
10 processUserInputReturn?: Awaited<
11 ReturnType<typeof import('./processUserInput/processUserInput.js').processUserInput>
12 >
13}): Promise<{
14 handlePromptSubmit: typeof import('./handlePromptSubmit.js').handlePromptSubmit
15 events: string[]
16}> {
17 const processUserInputPaths = [
18 import.meta.resolve('./processUserInput/processUserInput.ts'),
19 import.meta.resolve('./processUserInput/processUserInput.js'),
20 ]
21 const actualProcessUserInputModule = await import(
22 import.meta.resolve('./processUserInput/processUserInput.ts')
23 )
24
25 for (const path of processUserInputPaths) {
26 mock.module(path, () => ({
27 ...actualProcessUserInputModule,
28 processUserInput: async () =>
29 env?.processUserInputReturn ?? {
30 messages: [],
31 shouldQuery: true,
32 allowedTools: ['Bash'],
33 model: undefined,
34 effort: undefined,
35 nextInput: undefined,
36 submitNextInput: undefined,
37 },
38 }))
39 }
40
41 const { handlePromptSubmit } = await import('./handlePromptSubmit.js')
42
43 return { handlePromptSubmit, events: [] }
44}
45
46let originalBashCall: BashCall
47

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected