Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions tests/postgres/webhooks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,12 @@ async function logEvent(type: string, userId: string, metadata: Record<string, u

describe('webhook dispatch against the audit chain', () => {
it('starts after the newest event, then delivers each new one once, signed', async () => {
// Logged while no endpoint exists: the first endpoint starts after it, so it is not replayed.
await logEvent('user_deleted', '11111111-1111-4111-8111-111111111111');
const { secret } = await createEndpoint(
{ url: `http://127.0.0.1:${port}/hook`, eventTypes: ['user.deleted'] },
null,
);

// Before the cursor exists: history is not replayed.
await logEvent('user_deleted', '11111111-1111-4111-8111-111111111111');
expect(await dispatchWebhooks()).toBe(0);

await logEvent('user_deleted', '22222222-2222-4222-8222-222222222222');
Expand Down