mirror of
https://github.com/logto-io/logto.git
synced 2024-12-30 20:33:54 -05:00
chore(test): use fake time in webhook unit tests (#3933)
This commit is contained in:
parent
358561293f
commit
189f2d3af7
1 changed files with 4 additions and 0 deletions
|
@ -135,6 +135,8 @@ describe('testHook', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call sendWebhookRequest with correct values', async () => {
|
it('should call sendWebhookRequest with correct values', async () => {
|
||||||
|
jest.useFakeTimers().setSystemTime(100_000);
|
||||||
|
|
||||||
await testHook(hook.id, [HookEvent.PostSignIn], hook.config);
|
await testHook(hook.id, [HookEvent.PostSignIn], hook.config);
|
||||||
const testHookPayload = generateHookTestPayload(hook.id, HookEvent.PostSignIn);
|
const testHookPayload = generateHookTestPayload(hook.id, HookEvent.PostSignIn);
|
||||||
expect(sendWebhookRequest).toHaveBeenCalledWith({
|
expect(sendWebhookRequest).toHaveBeenCalledWith({
|
||||||
|
@ -142,6 +144,8 @@ describe('testHook', () => {
|
||||||
payload: testHookPayload,
|
payload: testHookPayload,
|
||||||
signingKey: hook.signingKey,
|
signingKey: hook.signingKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
jest.useRealTimers();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should call sendWebhookRequest with correct times if multiple events are provided', async () => {
|
it('should call sendWebhookRequest with correct times if multiple events are provided', async () => {
|
||||||
|
|
Loading…
Reference in a new issue