All files / repo-tools/src/test-utils promise-kit.ts

100% Statements 6/6
100% Branches 0/0
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18            141x     280x 280x 280x     280x      
/**
 * Create a module mock for `@endo/promise-kit`.
 *
 * @returns The mock.
 */
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const makePromiseKitMock = () => ({
  makePromiseKit: () => {
    let resolve: (value: unknown) => void, reject: (reason?: unknown) => void;
    const promise = new Promise((_resolve, _reject) => {
      resolve = _resolve;
      reject = _reject;
    });
    // @ts-expect-error We have in fact assigned resolve and reject.
    return { promise, resolve, reject };
  },
});