| 220 | |
| 221 | test("a listener bound by a REST API pull request URL counts as bound to the fixture PR", async () => { |
| 222 | const route = (resource: string, ...extra: string[]) => { |
| 223 | const context = evidence(); |
| 224 | context.snapshot.pr!.base = { ref: "main", repo: { id: 42 } }; |
| 225 | const output = extra.length ? [{ at: 15, stream: "stdout" as const, text: "7\n" }] : [stream()]; |
| 226 | context.calls = [{ ...wait(), arguments: ["event", "listen", "--resource", resource, "--event", "review", ...extra], |
| 227 | output }]; |
| 228 | return new EventRouteGrader(fixed(context)).grade({ trajectory }); |
| 229 | }; |
| 230 | assert.equal((await route("https://api.github.com/repos/sandbox/run/pulls/1")).passed, true); |
| 231 | assert.equal((await route("https://api.github.com/repositories/42/pulls/1")).passed, true); |
| 232 | assert.equal((await route("https://api.github.com/repos/sandbox/run/pulls/1", "--jq", ".id")).passed, true); |