diff --git a/packages/cli/src/webhooks/__tests__/webhook.service.test.ts b/packages/cli/src/webhooks/__tests__/webhook.service.test.ts index 13c921c65d..6a970aa583 100644 --- a/packages/cli/src/webhooks/__tests__/webhook.service.test.ts +++ b/packages/cli/src/webhooks/__tests__/webhook.service.test.ts @@ -179,12 +179,12 @@ describe('WebhookService', () => { }); describe('createWebhook()', () => { - test('should create the webhook', async () => { + test('should store webhook in DB', async () => { const mockWebhook = createWebhook('GET', 'user/:id'); await webhookService.storeWebhook(mockWebhook); - expect(webhookRepository.insert).toHaveBeenCalledWith(mockWebhook); + expect(webhookRepository.upsert).toHaveBeenCalledWith(mockWebhook, ['method', 'webhookPath']); }); }); }); diff --git a/packages/cli/src/webhooks/webhook.service.ts b/packages/cli/src/webhooks/webhook.service.ts index c72edc18d1..3d7e75871d 100644 --- a/packages/cli/src/webhooks/webhook.service.ts +++ b/packages/cli/src/webhooks/webhook.service.ts @@ -93,7 +93,7 @@ export class WebhookService { async storeWebhook(webhook: WebhookEntity) { void this.cacheService.set(webhook.cacheKey, webhook); - return await this.webhookRepository.insert(webhook); + await this.webhookRepository.upsert(webhook, ['method', 'webhookPath']); } createWebhook(data: Partial) {