Skip to content

Commit

Permalink
fix(core): Declutter webhook insertion errors (#10650)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivov authored Sep 3, 2024
1 parent 2ea2bfe commit 36177b0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/cli/src/webhooks/__tests__/webhook.service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
});
});
});
2 changes: 1 addition & 1 deletion packages/cli/src/webhooks/webhook.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<WebhookEntity>) {
Expand Down

0 comments on commit 36177b0

Please sign in to comment.