MCPcopy Create free account
hub / github.com/cli/cli / api

Function api

evals/src/harness.test.ts:63–76  ·  view source on GitHub ↗
(t: TestContext, expected: Expected[])

Source from the content-addressed store, hash-verified

61}
62
63function api(t: TestContext, expected: Expected[]): EventsGitHub {
64 const queue = [...expected];
65 t.after(() => assert.equal(queue.length, 0, "Unused expected API requests"));
66 return new EventsGitHub("fixture-token", async (input, init) => {
67 const next = queue.shift();
68 assert.ok(next, `Unexpected request ${init?.method} ${String(input)}`);
69 assert.equal(init?.method, next.method);
70 assert.equal(String(input), `https://api.github.com${next.path}`);
71 assert.equal(init?.redirect, "error");
72 next.check?.(JSON.parse(String(init?.body)));
73 const status = next.status ?? 200;
74 return new Response(status === 204 ? null : JSON.stringify(next.response), { status });
75 });
76}
77
78test("fixture cleanup uses the subscriber credential only for subscriptions", async t => {
79 const root = await temporary(t);

Callers 1

harness.test.tsFile · 0.85

Calls 1

checkMethod · 0.45

Tested by

no test coverage detected