From aee46552d679f4bbd2bfc81bcff11bc804207f18 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Thu, 17 Apr 2025 18:43:53 +0200 Subject: [PATCH] fix(backend): flaky notifications on mention in group unit test (#8404) --- ...tionsMiddleware.mentions-in-groups.spec.ts | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/backend/src/middleware/notifications/notificationsMiddleware.mentions-in-groups.spec.ts b/backend/src/middleware/notifications/notificationsMiddleware.mentions-in-groups.spec.ts index 575a2e86d..8bddff733 100644 --- a/backend/src/middleware/notifications/notificationsMiddleware.mentions-in-groups.spec.ts +++ b/backend/src/middleware/notifications/notificationsMiddleware.mentions-in-groups.spec.ts @@ -316,24 +316,32 @@ describe('mentions in groups', () => { }), ).resolves.toMatchObject({ data: { - notifications: [ + notifications: expect.arrayContaining([ { + createdAt: expect.any(String), from: { __typename: 'Post', id: 'public-post', + content: + 'Hey
@no-meber
@pending-member
@group-member.
! Please read this', }, read: false, reason: 'post_in_group', + relatedUser: null, }, { + createdAt: expect.any(String), from: { __typename: 'Post', id: 'public-post', + content: + 'Hey
@no-meber
@pending-member
@group-member.
! Please read this', }, read: false, reason: 'mentioned_in_post', + relatedUser: null, }, - ], + ]), }, errors: undefined, }) @@ -404,24 +412,32 @@ describe('mentions in groups', () => { }), ).resolves.toMatchObject({ data: { - notifications: [ + notifications: expect.arrayContaining([ { + createdAt: expect.any(String), from: { __typename: 'Post', id: 'closed-post', + content: + 'Hey members
@no-meber
@pending-member
@group-member.
! Please read this', }, read: false, reason: 'post_in_group', + relatedUser: null, }, { + createdAt: expect.any(String), from: { __typename: 'Post', id: 'closed-post', + content: + 'Hey members
@no-meber
@pending-member
@group-member.
! Please read this', }, read: false, reason: 'mentioned_in_post', + relatedUser: null, }, - ], + ]), }, errors: undefined, }) @@ -492,24 +508,32 @@ describe('mentions in groups', () => { }), ).resolves.toMatchObject({ data: { - notifications: [ + notifications: expect.arrayContaining([ { + createdAt: expect.any(String), from: { __typename: 'Post', id: 'hidden-post', + content: + 'Hey hiders
@no-meber
@pending-member
@group-member.
! Please read this', }, read: false, reason: 'post_in_group', + relatedUser: null, }, { + createdAt: expect.any(String), from: { __typename: 'Post', id: 'hidden-post', + content: + 'Hey hiders
@no-meber
@pending-member
@group-member.
! Please read this', }, read: false, reason: 'mentioned_in_post', + relatedUser: null, }, - ], + ]), }, errors: undefined, })