MCPcopy Create free account
hub / github.com/anomalyco/opencode / testLayer

Function testLayer

packages/opencode/test/installation/installation.test.ts:54–67  ·  view source on GitHub ↗
(
  httpHandler: (request: HttpClientRequest.HttpClientRequest) => Response,
  spawnHandler?: (cmd: string, args: readonly string[]) => string | { code: number; stdout?: string; stderr?: string },
)

Source from the content-addressed store, hash-verified

52}
53
54function testLayer(
55 httpHandler: (request: HttpClientRequest.HttpClientRequest) => Response,
56 spawnHandler?: (cmd: string, args: readonly string[]) => string | { code: number; stdout?: string; stderr?: string },
57) {
58 const spawnerNode = makeGlobalNode({
59 service: ChildProcessSpawner.ChildProcessSpawner,
60 layer: mockSpawner(spawnHandler),
61 deps: [],
62 })
63 return LayerNode.compile(Installation.node, [
64 [httpClient, mockHttpClient(httpHandler)],
65 [CrossSpawnSpawner.node, spawnerNode],
66 ])
67}
68
69describe("installation", () => {
70 describe("latest", () => {

Callers 1

Calls 2

mockSpawnerFunction · 0.85
mockHttpClientFunction · 0.85

Tested by

no test coverage detected