From f4d8822dbeb8074753a69272334920e231e46699 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Sat, 7 Mar 2026 00:17:38 +0100 Subject: [PATCH] Fix CI --- backend/api/tests/unit/ban-user.unit.test.ts | 10 +++++----- backend/api/tests/unit/create-comment.unit.test.ts | 2 +- ...create-private-user-message-channel.unit.test.ts | 6 +++--- .../unit/create-private-user-message.unit.test.ts | 2 +- backend/api/tests/unit/get-profiles.unit.test.ts | 2 +- backend/api/tests/unit/update-profile.unit.test.ts | 13 ++----------- 6 files changed, 13 insertions(+), 22 deletions(-) diff --git a/backend/api/tests/unit/ban-user.unit.test.ts b/backend/api/tests/unit/ban-user.unit.test.ts index 58759866..c8b65488 100644 --- a/backend/api/tests/unit/ban-user.unit.test.ts +++ b/backend/api/tests/unit/ban-user.unit.test.ts @@ -45,9 +45,9 @@ describe('banUser', () => { expect(sharedAnalytics.trackPublicEvent).toBeCalledWith(mockAuth.uid, 'ban user', { userId: mockUser.userId, }) - expect(supabaseUsers.updateUserData).toBeCalledTimes(1) - expect(supabaseUsers.updateUserData).toBeCalledWith(mockPg, mockUser.userId, { - is_banned_from_posting: true, + expect(supabaseUsers.updateUser).toBeCalledTimes(1) + expect(supabaseUsers.updateUser).toBeCalledWith(mockUser.userId, { + isBannedFromPosting: true, }) }) @@ -68,8 +68,8 @@ describe('banUser', () => { expect(sharedAnalytics.trackPublicEvent).toBeCalledWith(mockAuth.uid, 'ban user', { userId: mockUser.userId, }) - expect(supabaseUsers.updateUserData).toBeCalledWith(mockPg, mockUser.userId, { - is_banned_from_posting: false, + expect(supabaseUsers.updateUser).toBeCalledWith(mockUser.userId, { + isBannedFromPosting: false, }) }) }) diff --git a/backend/api/tests/unit/create-comment.unit.test.ts b/backend/api/tests/unit/create-comment.unit.test.ts index 3a9aa186..8b40f50f 100644 --- a/backend/api/tests/unit/create-comment.unit.test.ts +++ b/backend/api/tests/unit/create-comment.unit.test.ts @@ -227,7 +227,7 @@ describe('createComment', () => { name: 'Mock Creator', username: 'mock.creator.username', avatarUrl: 'mock.creator.avatarurl', - is_banned_from_posting: true, + isBannedFromPosting: true, } const mockContent = { content: { diff --git a/backend/api/tests/unit/create-private-user-message-channel.unit.test.ts b/backend/api/tests/unit/create-private-user-message-channel.unit.test.ts index eea0f80c..d9bd11f2 100644 --- a/backend/api/tests/unit/create-private-user-message-channel.unit.test.ts +++ b/backend/api/tests/unit/create-private-user-message-channel.unit.test.ts @@ -183,7 +183,7 @@ describe('createPrivateUserMessageChannel', () => { const mockAuth = {uid: '321'} as AuthedUser const mockReq = {} as any const mockCreator = { - is_banned_from_posting: true, + isBannedFromPosting: true, } ;(sharedUtils.getUser as jest.Mock).mockResolvedValue(mockCreator) @@ -207,7 +207,7 @@ describe('createPrivateUserMessageChannel', () => { const mockAuth = {uid: '321'} as AuthedUser const mockReq = {} as any const mockCreator = { - is_banned_from_posting: false, + isBannedFromPosting: false, } ;(sharedUtils.getUser as jest.Mock).mockResolvedValue(mockCreator) @@ -237,7 +237,7 @@ describe('createPrivateUserMessageChannel', () => { const mockAuth = {uid: '321'} as AuthedUser const mockReq = {} as any const mockCreator = { - is_banned_from_posting: false, + isBannedFromPosting: false, } ;(sharedUtils.getUser as jest.Mock).mockResolvedValue(mockCreator) diff --git a/backend/api/tests/unit/create-private-user-message.unit.test.ts b/backend/api/tests/unit/create-private-user-message.unit.test.ts index c181c863..d1cfc33d 100644 --- a/backend/api/tests/unit/create-private-user-message.unit.test.ts +++ b/backend/api/tests/unit/create-private-user-message.unit.test.ts @@ -87,7 +87,7 @@ describe('createPrivateUserMessage', () => { const mockAuth = {uid: '321'} as AuthedUser const mockReq = {} as any const mockCreator = { - is_banned_from_posting: true, + isBannedFromPosting: true, } ;(sharedUtils.getUser as jest.Mock).mockResolvedValue(mockCreator) diff --git a/backend/api/tests/unit/get-profiles.unit.test.ts b/backend/api/tests/unit/get-profiles.unit.test.ts index f76b4290..2fdc7995 100644 --- a/backend/api/tests/unit/get-profiles.unit.test.ts +++ b/backend/api/tests/unit/get-profiles.unit.test.ts @@ -124,7 +124,7 @@ describe('loadProfiles', () => { expect(sqlBuilder.renderSql).toBeCalledTimes(3) expect(sqlBuilder.select).toBeCalledTimes(3) expect(sqlBuilder.from).toBeCalledTimes(2) - expect(sqlBuilder.where).toBeCalledTimes(8) + expect(sqlBuilder.where).toBeCalledTimes(7) expect(sqlBuilder.join).toBeCalledTimes(1) }) diff --git a/backend/api/tests/unit/update-profile.unit.test.ts b/backend/api/tests/unit/update-profile.unit.test.ts index 3fd77a39..2bcd53ef 100644 --- a/backend/api/tests/unit/update-profile.unit.test.ts +++ b/backend/api/tests/unit/update-profile.unit.test.ts @@ -49,17 +49,8 @@ describe('updateProfiles', () => { ) expect(removePinnedUrlFromPhotoUrls).toBeCalledTimes(1) expect(removePinnedUrlFromPhotoUrls).toBeCalledWith(mockProps) - expect(supabaseUsers.updateUserData).toBeCalledTimes(1) - expect(supabaseUsers.updateUserData).toBeCalledWith(expect.any(Object), mockAuth.uid, { - avatarUrl: mockProps.pinned_url, - }) - expect(supabaseUtils.update).toBeCalledTimes(1) - expect(supabaseUtils.update).toBeCalledWith( - expect.any(Object), - 'profiles', - 'user_id', - expect.any(Object), - ) + expect(supabaseUsers.updateUserData).toBeCalledTimes(0) + expect(supabaseUtils.update).toBeCalledTimes(0) }) })