From 8e643747f84e8fe83191ce0c253ea03e2cb892b3 Mon Sep 17 00:00:00 2001 From: Phillip Thelen Date: Wed, 4 Sep 2024 01:21:00 +0200 Subject: [PATCH] Fix tests being dependant on NEW_MYSTERY_ITEMS notification (#15288) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix tests being dependant on NEW_MYSTERY_ITEMS notification * remove only * don’t actually need to check notification count * fix tests --------- Co-authored-by: Sabe Jones --- .../tasks/groups/POST-tasks_group_id_assign_user_id.test.js | 6 +++--- .../tasks/groups/POST-tasks_task_id_unassign.test.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/api/v3/integration/tasks/groups/POST-tasks_group_id_assign_user_id.test.js b/test/api/v3/integration/tasks/groups/POST-tasks_group_id_assign_user_id.test.js index 2e122e78fc..1870f5b768 100644 --- a/test/api/v3/integration/tasks/groups/POST-tasks_group_id_assign_user_id.test.js +++ b/test/api/v3/integration/tasks/groups/POST-tasks_group_id_assign_user_id.test.js @@ -105,9 +105,9 @@ describe('POST /tasks/:taskId/assign/:memberId', () => { const groupTask = await user.get(`/tasks/group/${guild._id}`); - expect(member.notifications.length).to.equal(2); - expect(member.notifications[1].type).to.equal('GROUP_TASK_ASSIGNED'); - expect(member.notifications[1].taskId).to.equal(groupTask._id); + const lastNotification = member.notifications[member.notifications.length - 1]; + expect(lastNotification.type).to.equal('GROUP_TASK_ASSIGNED'); + expect(lastNotification.taskId).to.equal(groupTask._id); }); it('assigns a task to multiple users', async () => { diff --git a/test/api/v3/integration/tasks/groups/POST-tasks_task_id_unassign.test.js b/test/api/v3/integration/tasks/groups/POST-tasks_task_id_unassign.test.js index 117c9f760f..7338482971 100644 --- a/test/api/v3/integration/tasks/groups/POST-tasks_task_id_unassign.test.js +++ b/test/api/v3/integration/tasks/groups/POST-tasks_task_id_unassign.test.js @@ -89,10 +89,12 @@ describe('POST /tasks/:taskId/unassign/:memberId', () => { }); it('removes task assignment notification from unassigned user', async () => { + await member.sync(); + const oldNotificationCount = member.notifications.length; await user.post(`/tasks/${task._id}/unassign/${member._id}`); await member.sync(); - expect(member.notifications.length).to.equal(1); // mystery items + expect(member.notifications.length).to.equal(oldNotificationCount - 1); }); it('unassigns a user and only that user from a task', async () => {