Skip to content

Commit b5344d5

Browse files
committed
test(slack): stop racing the aborted read request in the Web API bound test
`bounds dedicated reads without timing out shared clients` asserted the mock server received exactly two requests, but the read client aborts at 20ms and the server records on arrival, so whether the aborted request lands first is a race. It failed on a loaded CI runner with 1 received. The bound is still asserted directly (read rejects, shared resolves); the count now only requires the shared client's arrival, and checks its token so the dedicated client is still proven not to have carried the call. Unrelated to this PR's theme work; fixed here rather than left red.
1 parent 2a5cbab commit b5344d5

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎extensions/slack/src/client.web-api.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,12 @@ describe("Slack Web API routing", () => {
379379
await expect(readClient.auth.test()).rejects.toThrow();
380380
await expect(sharedClient.auth.test()).resolves.toMatchObject({ ok: true });
381381

382-
expect(requests).toHaveLength(2);
382+
// The read client aborts at 20ms, so whether its request reaches the
383+
// server before the abort is a race on a loaded runner. The bound itself
384+
// is asserted above; here only the shared client's arrival is certain,
385+
// and its token proves the dedicated client did not carry the call.
386+
expect(requests.length).toBeGreaterThanOrEqual(1);
387+
expect(requests.at(-1)?.authorization).toBe("Bearer xoxb-shared");
383388
} finally {
384389
await server.close();
385390
}

0 commit comments

Comments
 (0)