mirror of
https://github.com/strapi/strapi.git
synced 2025-09-22 06:50:51 +00:00
fix entity service webhook test
This commit is contained in:
parent
84352c1e88
commit
c396c899b7
@ -16,27 +16,33 @@ describe('Entity service triggers webhooks', () => {
|
|||||||
let entity = { attr: 'value' };
|
let entity = { attr: 'value' };
|
||||||
|
|
||||||
beforeAll(() => {
|
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({
|
instance = createEntityService({
|
||||||
strapi: {
|
strapi: global.strapi,
|
||||||
getModel: () => ({
|
|
||||||
kind: 'singleType',
|
|
||||||
modelName: 'test-model',
|
|
||||||
privateAttributes: [],
|
|
||||||
attributes: {
|
|
||||||
attr: { type: 'string' },
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
db: {
|
db: {
|
||||||
query: () => ({
|
query: () => fakeDB,
|
||||||
count: () => 0,
|
|
||||||
create: ({ data }) => data,
|
|
||||||
update: ({ data }) => data,
|
|
||||||
findOne: () => entity,
|
|
||||||
findMany: () => [entity, entity],
|
|
||||||
delete: () => ({}),
|
|
||||||
deleteMany: () => ({}),
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
eventHub,
|
eventHub,
|
||||||
entityValidator,
|
entityValidator,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user