From e0a5938711c6a94c417366fea9141743a1196c9d Mon Sep 17 00:00:00 2001 From: SabreCat Date: Mon, 6 Feb 2023 21:34:29 -0600 Subject: [PATCH] fix(test): update expectations for new flagging logic --- .../chat/POST-groups_id_chat_id_clear_flags.test.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/test/api/v3/integration/chat/POST-groups_id_chat_id_clear_flags.test.js b/test/api/v3/integration/chat/POST-groups_id_chat_id_clear_flags.test.js index 4bb99cc33f..9f98d73d85 100644 --- a/test/api/v3/integration/chat/POST-groups_id_chat_id_clear_flags.test.js +++ b/test/api/v3/integration/chat/POST-groups_id_chat_id_clear_flags.test.js @@ -66,7 +66,7 @@ describe('POST /groups/:id/chat/:id/clearflags', () => { type: 'party', privacy: 'private', }, - members: 1, + members: 2, }); await members[0].update({ 'auth.timestamps.created': new Date('2022-01-01') }); @@ -76,12 +76,17 @@ describe('POST /groups/:id/chat/:id/clearflags', () => { await admin.post(`/groups/${group._id}/chat/${privateMessage.id}/flag`); // first test that the flag was actually successful + // author always sees own message; flag count is hidden from non-admins let messages = await members[0].get(`/groups/${group._id}/chat`); - expect(messages[0].flagCount).to.eql(5); + expect(messages[0].flagCount).to.eql(0); + messages = await members[1].get(`/groups/${group._id}/chat`); + expect(messages.length).to.eql(0); + // admin cannot directly request private group chat, but after unflag, + // message should be revealed again and still have flagCount of 0 await admin.post(`/groups/${group._id}/chat/${privateMessage.id}/clearflags`); - - messages = await members[0].get(`/groups/${group._id}/chat`); + messages = await members[1].get(`/groups/${group._id}/chat`); + expect(messages.length).to.eql(1); expect(messages[0].flagCount).to.eql(0); });