From 61a474c0b4fe03451565b6f99da4dbb3314153c7 Mon Sep 17 00:00:00 2001 From: Jamie Howard Date: Thu, 25 May 2023 13:14:39 +0100 Subject: [PATCH] test(entity-service) --- .../entity-service/__tests__/entity-service.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/core/strapi/lib/services/entity-service/__tests__/entity-service.test.js b/packages/core/strapi/lib/services/entity-service/__tests__/entity-service.test.js index 089d8007b2..4167493f67 100644 --- a/packages/core/strapi/lib/services/entity-service/__tests__/entity-service.test.js +++ b/packages/core/strapi/lib/services/entity-service/__tests__/entity-service.test.js @@ -20,6 +20,12 @@ describe('Entity service', () => { query: jest.fn(() => ({})), }; + beforeEach(() => { + global.strapi.webhookStore = { + allowedEvents: new Map([['ENTRY_CREATE', 'entry.create']]), + }; + }); + describe('Decorator', () => { test.each(['create', 'update', 'findMany', 'findOne', 'delete', 'count', 'findPage'])( 'Can decorate', @@ -98,12 +104,15 @@ describe('Entity service', () => { global.strapi.getModel.mockImplementation((modelName) => fakeModels[modelName]); global.strapi.query.mockImplementation(() => fakeQuery); }); + beforeEach(() => { jest.clearAllMocks(); }); + afterAll(() => { global.strapi.getModel.mockImplementation(() => ({})); }); + describe('assign default values', () => { let instance; const entityUID = 'api::entity.entity';