This commit is contained in:
MartinBraquet
2026-03-07 00:17:38 +01:00
parent 0655266366
commit f4d8822dbe
6 changed files with 13 additions and 22 deletions

View File

@@ -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,
})
})
})

View File

@@ -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: {

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)
})

View File

@@ -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)
})
})