(
// for purpose of this test, Error object will become a rejection value
resolutionOrRejectionValue: T,
ms = 1,
)
| 5 | |
| 6 | const createJobFactory = |
| 7 | <T>( |
| 8 | // for purpose of this test, Error object will become a rejection value |
| 9 | resolutionOrRejectionValue: T, |
| 10 | ms = 1, |
| 11 | ) => |
| 12 | () => { |
| 13 | return new Promise<T>((resolve, reject) => { |
| 14 | setTimeout(() => { |
| 15 | if (resolutionOrRejectionValue instanceof Error) { |
| 16 | reject(resolutionOrRejectionValue); |
| 17 | } else { |
| 18 | resolve(resolutionOrRejectionValue); |
| 19 | } |
| 20 | }, ms); |
| 21 | }).then((x) => { |
| 22 | calls.push(x); |
| 23 | return x; |
| 24 | }); |
| 25 | }; |
| 26 | |
| 27 | beforeEach(() => { |
| 28 | calls.length = 0; |
no test coverage detected
searching dependent graphs…