fix(core): Declutter webhook insertion errors (#10650)
Some checks are pending
Test Master / install-and-build (push) Waiting to run
Test Master / Unit tests (18.x) (push) Blocked by required conditions
Test Master / Unit tests (20.x) (push) Blocked by required conditions
Test Master / Unit tests (22.4) (push) Blocked by required conditions
Test Master / Lint (push) Blocked by required conditions
Test Master / Notify Slack on failure (push) Blocked by required conditions
Benchmark Docker Image CI / build (push) Waiting to run

This commit is contained in:
Iván Ovejero 2024-09-03 17:58:26 +02:00 committed by GitHub
parent 2ea2bfe762
commit 36177b0943
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View file

@ -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']);
});
});
});

View file

@ -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>) {