test(entity-service)

This commit is contained in:
Jamie Howard 2023-05-25 13:14:39 +01:00
parent aac731d7a0
commit 61a474c0b4

View File

@ -20,6 +20,12 @@ describe('Entity service', () => {
query: jest.fn(() => ({})), query: jest.fn(() => ({})),
}; };
beforeEach(() => {
global.strapi.webhookStore = {
allowedEvents: new Map([['ENTRY_CREATE', 'entry.create']]),
};
});
describe('Decorator', () => { describe('Decorator', () => {
test.each(['create', 'update', 'findMany', 'findOne', 'delete', 'count', 'findPage'])( test.each(['create', 'update', 'findMany', 'findOne', 'delete', 'count', 'findPage'])(
'Can decorate', 'Can decorate',
@ -98,12 +104,15 @@ describe('Entity service', () => {
global.strapi.getModel.mockImplementation((modelName) => fakeModels[modelName]); global.strapi.getModel.mockImplementation((modelName) => fakeModels[modelName]);
global.strapi.query.mockImplementation(() => fakeQuery); global.strapi.query.mockImplementation(() => fakeQuery);
}); });
beforeEach(() => { beforeEach(() => {
jest.clearAllMocks(); jest.clearAllMocks();
}); });
afterAll(() => { afterAll(() => {
global.strapi.getModel.mockImplementation(() => ({})); global.strapi.getModel.mockImplementation(() => ({}));
}); });
describe('assign default values', () => { describe('assign default values', () => {
let instance; let instance;
const entityUID = 'api::entity.entity'; const entityUID = 'api::entity.entity';