mirror of
https://github.com/strapi/strapi.git
synced 2025-08-07 16:29:18 +00:00
fix(ee): use entity service directly for emit event calls
This commit is contained in:
parent
34483f58ea
commit
b9a173fce8
@ -108,7 +108,6 @@ describe('Entity service decorator', () => {
|
|||||||
|
|
||||||
const defaultService = {
|
const defaultService = {
|
||||||
update: jest.fn(() => Promise.resolve(entry)),
|
update: jest.fn(() => Promise.resolve(entry)),
|
||||||
emitEvent: jest.fn(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
global.strapi = {
|
global.strapi = {
|
||||||
@ -117,6 +116,7 @@ describe('Entity service decorator', () => {
|
|||||||
findOne: jest.fn(() => {
|
findOne: jest.fn(() => {
|
||||||
return { strapi_reviewWorkflows_stage: { id: 2, workflow: { id: 1 } } };
|
return { strapi_reviewWorkflows_stage: { id: 2, workflow: { id: 1 } } };
|
||||||
}),
|
}),
|
||||||
|
emitEvent: jest.fn(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -126,7 +126,10 @@ describe('Entity service decorator', () => {
|
|||||||
const input = { data: { title: 'title ', strapi_reviewWorkflows_stage: 1 } };
|
const input = { data: { title: 'title ', strapi_reviewWorkflows_stage: 1 } };
|
||||||
await service.update(uid, id, input);
|
await service.update(uid, id, input);
|
||||||
|
|
||||||
expect(defaultService.emitEvent).toHaveBeenCalledWith(uid, WORKFLOW_UPDATE_STAGE, {
|
expect(global.strapi.entityService.emitEvent).toHaveBeenCalledWith(
|
||||||
|
uid,
|
||||||
|
WORKFLOW_UPDATE_STAGE,
|
||||||
|
{
|
||||||
entityId: 1,
|
entityId: 1,
|
||||||
workflow: {
|
workflow: {
|
||||||
id: 1,
|
id: 1,
|
||||||
@ -135,7 +138,8 @@ describe('Entity service decorator', () => {
|
|||||||
to: 1,
|
to: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
expect(defaultService.update).toHaveBeenCalledWith(uid, id, {
|
expect(defaultService.update).toHaveBeenCalledWith(uid, id, {
|
||||||
...input,
|
...input,
|
||||||
|
@ -84,7 +84,7 @@ const decorator = (service) => ({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
await service.emitEvent.call(this, uid, WORKFLOW_UPDATE_STAGE, webhookPayload);
|
await strapi.entityService.emitEvent(uid, WORKFLOW_UPDATE_STAGE, webhookPayload);
|
||||||
}
|
}
|
||||||
|
|
||||||
return updatedEntity;
|
return updatedEntity;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user