MCPcopy Create free account
hub / github.com/angular/components / expectAsyncError

Function expectAsyncError

src/cdk/testing/tests/cross-environment-tests.ts:347–357  ·  view source on GitHub ↗
(fn: () => Promise<void>, expected: Error)

Source from the content-addressed store, hash-verified

345 });
346
347 async function expectAsyncError(fn: () => Promise<void>, expected: Error) {
348 let error: unknown | null = null;
349 try {
350 await fn();
351 } catch (e: unknown) {
352 error = e;
353 }
354 expect(error).not.toBe(null);
355 expect(error instanceof Error).toBe(true);
356 expect((error as Error).message).toBe(expected.message);
357 }
358
359 it('should be able to clear', async () => {
360 const input = await harness.input();

Callers 1

crossEnvironmentSpecsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected