Skip to content

Commit e825a56

Browse files
committed
Fix profile tests
1 parent e2caf27 commit e825a56

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

packages/web/src/pages/profile-page/ProfilePage.test.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,10 @@ describe('ProfilePage', () => {
107107
it('should render the profile page for a non-artist', async () => {
108108
renderProfilePage(nonArtistUser)
109109

110-
// User header
111-
expect(
112-
await screen.findByRole('heading', { name: nonArtistUser.name })
113-
).toBeInTheDocument()
110+
// User header (name may have trailing space in mobile header)
114111
expect(
115112
await screen.findByRole('heading', {
116-
name: `@${nonArtistUser.handle}`
113+
name: new RegExp(`^${nonArtistUser.name}\\s*$`)
117114
})
118115
).toBeInTheDocument()
119116

@@ -237,9 +234,11 @@ describe('ProfilePage', () => {
237234
}
238235
)
239236

240-
// Wait for the profile to load
237+
// Wait for the profile to load (name may have trailing space in mobile header)
241238
expect(
242-
await screen.findByRole('heading', { name: artistUser.name })
239+
await screen.findByRole('heading', {
240+
name: new RegExp(`^${artistUser.name}\\s*$`)
241+
})
243242
).toBeInTheDocument()
244243

245244
// Verify that coin-related elements are present when user has coins

packages/web/src/test/msw/mswMocks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type TestUser = typeof artistUser | typeof nonArtistUser
3131
*/
3232
export const mockUserByHandle = (user: typeof artistUser) =>
3333
http.get(`${apiEndpoint}/v1/users/handle/${user.handle}`, () =>
34-
HttpResponse.json({ data: [user] })
34+
HttpResponse.json({ data: user })
3535
)
3636

3737
export const mockRelatedUsers = (

0 commit comments

Comments
 (0)