Skip to content

Commit

Permalink
fix useFakeTimers call
Browse files Browse the repository at this point in the history
  • Loading branch information
aecorredor committed Feb 26, 2024
1 parent ccdd484 commit 80e2aef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/lambda-invocation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,19 +482,19 @@ test('A configured timeout does not hinder normal lambda function invocation beh
});

test('A configured timeout does not eat lambda function invocation errors', async () => {
jest.useFakeTimers();
jest.useFakeTimers({ doNotFake: ['performance'] });
jest.spyOn(global, 'setTimeout');
jest.spyOn(global, 'clearTimeout');
delayedLambda(1, new Error('Other error'));
const promise = ctx.alpha.get('/some/path', {
Lambda: FakeLambda,
timeout: 1000,
} as any as AxiosRequestConfig);
});
await expect(promise).rejects.toThrow('Other error');
expect(ctx.abort).not.toBeCalled();
expect(ctx.abort).not.toHaveBeenCalled();

expect(setTimeout).toBeCalledTimes(1);
expect(clearTimeout).toBeCalledTimes(1);
expect(setTimeout).toHaveBeenCalledTimes(1);
expect(clearTimeout).toHaveBeenCalledTimes(1);
});

test('lambda function invocation errors are re-thrown', async () => {
Expand Down

0 comments on commit 80e2aef

Please sign in to comment.