fix(backend): fix flaky backend tests (#9433)

This commit is contained in:
Ulf Gebhardt 2026-03-24 02:38:16 +01:00 committed by GitHub
parent fa5c225138
commit 53a13c2173
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -293,7 +293,7 @@ describe('pin groupPosts', () => {
config = { ...defaultConfig, MAX_GROUP_PINNED_POSTS: 2 }
authenticatedUser = await publicUser.toJson()
})
it('returns post-1-to-public-group as first, post-2-to-public-group as second pinned post', async () => {
it('returns pinned posts before unpinned posts', async () => {
await mutate({ mutation: pinGroupPost, variables: { id: 'post-1-to-public-group' } })
await mutate({ mutation: pinGroupPost, variables: { id: 'post-2-to-public-group' } })
await expect(
@ -308,8 +308,9 @@ describe('pin groupPosts', () => {
errors: undefined,
data: {
profilePagePosts: [
expect.objectContaining({ id: 'post-2-to-public-group', groupPinned: true }),
expect.objectContaining({ id: 'post-1-to-public-group', groupPinned: true }),
// Order between pinned posts may vary (same sortDate), so use arrayContaining for the first two
expect.objectContaining({ groupPinned: true }),
expect.objectContaining({ groupPinned: true }),
expect.objectContaining({ id: 'post-3-to-public-group', groupPinned: null }),
],
},