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 = {
|
||||
update: jest.fn(() => Promise.resolve(entry)),
|
||||
emitEvent: jest.fn(),
|
||||
};
|
||||
|
||||
global.strapi = {
|
||||
@ -117,6 +116,7 @@ describe('Entity service decorator', () => {
|
||||
findOne: jest.fn(() => {
|
||||
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 } };
|
||||
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,
|
||||
workflow: {
|
||||
id: 1,
|
||||
@ -135,7 +138,8 @@ describe('Entity service decorator', () => {
|
||||
to: 1,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
expect(defaultService.update).toHaveBeenCalledWith(uid, id, {
|
||||
...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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user