MCPcopy
hub / github.com/jestjs/jest / asyncFn

Function asyncFn

packages/expect/src/__tests__/toThrowMatchers.test.ts:575–585  ·  view source on GitHub ↗
(shouldThrow?: boolean, resolve?: boolean)

Source from the content-addressed store, hash-verified

573
574 describe('promise/async throws if Error-like object is returned', () => {
575 const asyncFn = async (shouldThrow?: boolean, resolve?: boolean) => {
576 let err;
577 if (shouldThrow) {
578 err = new Err('async apple');
579 }
580 if (resolve) {
581 return err || 'apple';
582 } else {
583 throw err || 'apple';
584 }
585 };
586
587 test('passes', async () => {
588 expect.assertions(24);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected