@ -44,6 +44,7 @@ router.post('events.list', auth(), pagination(), async ctx => {
|
||||
{
|
||||
model: User,
|
||||
as: 'actor',
|
||||
paranoid: false,
|
||||
},
|
||||
],
|
||||
offset: ctx.state.pagination.offset,
|
||||
|
@ -39,6 +39,30 @@ describe('#events.list', async () => {
|
||||
expect(body.data[0].id).toEqual(event.id);
|
||||
});
|
||||
|
||||
it('should return events with deleted actors', async () => {
|
||||
const { user, admin, document, collection } = await seed();
|
||||
|
||||
// event viewable in activity stream
|
||||
const event = await buildEvent({
|
||||
name: 'documents.publish',
|
||||
collectionId: collection.id,
|
||||
documentId: document.id,
|
||||
teamId: user.teamId,
|
||||
actorId: user.id,
|
||||
});
|
||||
|
||||
await user.destroy();
|
||||
|
||||
const res = await server.post('/api/events.list', {
|
||||
body: { token: admin.getJwtToken() },
|
||||
});
|
||||
const body = await res.json();
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(body.data.length).toEqual(1);
|
||||
expect(body.data[0].id).toEqual(event.id);
|
||||
});
|
||||
|
||||
it('should require authentication', async () => {
|
||||
const res = await server.post('/api/events.list');
|
||||
const body = await res.json();
|
||||
|
Reference in New Issue
Block a user