MCPcopy Create free account
hub / github.com/denoland/std / assertRejectsReason

Function assertRejectsReason

async/delay_test.ts:55–65  ·  view source on GitHub ↗
(reason: unknown)

Source from the content-addressed store, hash-verified

53
54Deno.test("delay() checks abort reason", async (ctx) => {
55 async function assertRejectsReason(reason: unknown) {
56 const start = new Date();
57 const abort = new AbortController();
58 const { signal } = abort;
59 const delayedPromise = delay(100, { signal });
60 setTimeout(() => abort.abort(reason), 0);
61 const cause = await assertRejects(() => delayedPromise);
62 const diff = new Date().getTime() - start.getTime();
63 assert(diff < 100);
64 assertStrictEquals(cause, reason);
65 }
66
67 await ctx.step("not-undefined values", async () => {
68 await Promise.all([

Callers

nothing calls this directly

Calls 5

delayFunction · 0.90
assertRejectsFunction · 0.90
assertFunction · 0.90
assertStrictEqualsFunction · 0.90
abortMethod · 0.45

Tested by

no test coverage detected