0
Fork 0
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:
Xiao Yijun 2023-05-31 20:03:08 +08:00 committed by GitHub
parent 358561293f
commit 189f2d3af7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -135,6 +135,8 @@ describe('testHook', () => {
});
it('should call sendWebhookRequest with correct values', async () => {
jest.useFakeTimers().setSystemTime(100_000);
await testHook(hook.id, [HookEvent.PostSignIn], hook.config);
const testHookPayload = generateHookTestPayload(hook.id, HookEvent.PostSignIn);
expect(sendWebhookRequest).toHaveBeenCalledWith({
@ -142,6 +144,8 @@ describe('testHook', () => {
payload: testHookPayload,
signingKey: hook.signingKey,
});
jest.useRealTimers();
});
it('should call sendWebhookRequest with correct times if multiple events are provided', async () => {