fix entity service webhook test

This commit is contained in:
Marc-Roig 2022-08-26 15:00:10 +02:00
parent 84352c1e88
commit c396c899b7

View File

@ -16,27 +16,33 @@ describe('Entity service triggers webhooks', () => {
let entity = { attr: 'value' };
beforeAll(() => {
const fakeDB = {
count: () => 0,
create: ({ data }) => data,
update: ({ data }) => data,
findOne: () => entity,
findMany: () => [entity, entity],
delete: () => ({}),
deleteMany: () => ({}),
load: () => ({}),
};
global.strapi = {
getModel: () => ({
kind: 'singleType',
modelName: 'test-model',
privateAttributes: [],
attributes: {
attr: { type: 'string' },
},
}),
query: () => fakeDB,
};
instance = createEntityService({
strapi: {
getModel: () => ({
kind: 'singleType',
modelName: 'test-model',
privateAttributes: [],
attributes: {
attr: { type: 'string' },
},
}),
},
strapi: global.strapi,
db: {
query: () => ({
count: () => 0,
create: ({ data }) => data,
update: ({ data }) => data,
findOne: () => entity,
findMany: () => [entity, entity],
delete: () => ({}),
deleteMany: () => ({}),
}),
query: () => fakeDB,
},
eventHub,
entityValidator,