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

Function gh

evals/src/smoke.test.ts:83–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81 const held = new Set<string>();
82 const ran: string[] = [];
83 const gh: GhRunner = async args => {
84 ran.push(args.slice(0, 3).join(" "));
85 const [, , sub, id] = args;
86 const ok = (stdout: string) => ({ code: 0, stdout, stderr: "" });
87 if (sub === "create") { held.add("sub_new"); return ok("sub_new\n"); }
88 if (sub === "list") return ok(JSON.stringify([...held].map(held => ({ id: held }))));
89 if (sub === "delete") { held.delete(id!); return ok(""); }
90 if (sub === "view" && held.has(id!)) return ok(JSON.stringify({ id, resourceUrl: prUrl, eventTypes: [type] }));
91 return { code: 1, stdout: "", stderr: `subscription ${id} was not found; it may have expired` };
92 };
93 assert.equal(await runSubscriptionCommands(gh, prUrl), "sub_new");
94 assert.deepEqual(ran, ["event subscription create", "event subscription view", "event subscription list",
95 "event subscription delete", "event subscription view"]);

Callers 3

undeletedFunction · 0.85
expectFunction · 0.85
runSubscriptionCommandsFunction · 0.85

Calls 3

okFunction · 0.85
pushMethod · 0.80
deleteMethod · 0.65

Tested by

no test coverage detected