mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
Fixed auditlogs tests making waitinf for the emit
This commit is contained in:
parent
6af468be37
commit
fd0c592c0b
@ -4,7 +4,6 @@ const { features } = require('@strapi/strapi/lib/utils/ee');
|
||||
const executeCEDestroy = require('../../server/destroy');
|
||||
|
||||
module.exports = async ({ strapi }) => {
|
||||
console.log('destroy lifecycle');
|
||||
if (features.isEnabled('audit-logs')) {
|
||||
strapi.container.get('audit-logs').destroy();
|
||||
}
|
||||
|
@ -84,10 +84,10 @@ describe('Audit logs auth', () => {
|
||||
|
||||
const eventName = 'test';
|
||||
const eventPayload = { meta: 'test' };
|
||||
strapi.eventHub.emit(eventName, eventPayload);
|
||||
await strapi.eventHub.emit(eventName, eventPayload);
|
||||
// TODO: Replace with a test to save to db
|
||||
expect(logSpy).toHaveBeenCalledWith(
|
||||
`Listened to event ${eventName} with args: ${JSON.stringify(eventPayload)}`
|
||||
`Listened to event ${eventName} with args: [${JSON.stringify(eventPayload)}]`
|
||||
);
|
||||
});
|
||||
|
||||
@ -96,8 +96,8 @@ describe('Audit logs auth', () => {
|
||||
auditLogsService.register();
|
||||
|
||||
expect(() => {
|
||||
strapi.eventHub.emit('', { meta: 'test' });
|
||||
}).toThrowError('Name is required');
|
||||
return strapi.eventHub.emit('', { meta: 'test' });
|
||||
}).rejects.toThrowError('Name is required');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user