mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
test(async): use generic assertRejects in pool_test.ts (#2287)
Fixes a deprecation warning. Resolves https://github.com/denoland/deno_std/issues/2283
This commit is contained in:
parent
564d2ed8ab
commit
3c129122f1
@ -34,17 +34,16 @@ Deno.test("[async] pooledMap errors", async () => {
|
||||
return n;
|
||||
}
|
||||
const mappedNumbers: number[] = [];
|
||||
await assertRejects(async () => {
|
||||
const error = await assertRejects(async () => {
|
||||
for await (const m of pooledMap(3, [1, 2, 3, 4], mapNumber)) {
|
||||
mappedNumbers.push(m);
|
||||
}
|
||||
}, (error: Error) => {
|
||||
assert(error instanceof AggregateError);
|
||||
assert(error.message === ERROR_WHILE_MAPPING_MESSAGE);
|
||||
assertEquals(error.errors.length, 2);
|
||||
assertStringIncludes(error.errors[0].stack, "Error: Bad number: 1");
|
||||
assertStringIncludes(error.errors[1].stack, "Error: Bad number: 2");
|
||||
});
|
||||
}, AggregateError);
|
||||
assert(error instanceof AggregateError);
|
||||
assert(error.message === ERROR_WHILE_MAPPING_MESSAGE);
|
||||
assertEquals(error.errors.length, 2);
|
||||
assertStringIncludes(error.errors[0].stack, "Error: Bad number: 1");
|
||||
assertStringIncludes(error.errors[1].stack, "Error: Bad number: 2");
|
||||
assertEquals(mappedNumbers, [3]);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user