MCPcopy Create free account
hub / github.com/Kong/insomnia / assertAsyncError

Function assertAsyncError

packages/insomnia/src/sync/git/__tests__/util.ts:3–16  ·  view source on GitHub ↗
(promise: Promise<any>, code?: string)

Source from the content-addressed store, hash-verified

1import { expect } from 'vitest';
2
3export async function assertAsyncError(promise: Promise<any>, code?: string) {
4 try {
5 await promise;
6 } catch (err) {
7 if (code) {
8 expect(err.message).toMatch(new RegExp(`^${code}.+`));
9 expect(err.code).toBe(code);
10 }
11
12 return;
13 }
14
15 throw new Error('Promise did not throw');
16}

Callers 2

mem-client.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected