MCPcopy Index your code
hub / github.com/simstudioai/sim / setup

Method setup

packages/testing/src/builders/tool-tester.builder.ts:136–149  ·  view source on GitHub ↗

* Setup mock responses for this tool

(
    response: unknown,
    options: { ok?: boolean; status?: number; headers?: Record<string, string> } = {}
  )

Source from the content-addressed store, hash-verified

134 * Setup mock responses for this tool
135 */
136 setup(
137 response: unknown,
138 options: { ok?: boolean; status?: number; headers?: Record<string, string> } = {}
139 ) {
140 this.mockResponse = response
141 this.mockResponseOptions = {
142 ok: options.ok ?? true,
143 status: options.status ?? 200,
144 headers: options.headers ?? { 'content-type': 'application/json' },
145 }
146 this.mockFetch = createToolMockFetch(this.mockResponse, this.mockResponseOptions)
147 global.fetch = Object.assign(this.mockFetch, { preconnect: vi.fn() }) as typeof fetch
148 return this
149 }
150
151 /**
152 * Setup error responses for this tool

Callers 2

execute.test.tsFile · 0.80
request.test.tsFile · 0.80

Calls 1

createToolMockFetchFunction · 0.85

Tested by

no test coverage detected