Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ describe('NotificationsPageContent', () => {
mockLoading = false;
mockData = { notifications: [] };
render(<NotificationsPageContent />);
expect(screen.getByText(/don't have any alerts/i)).toBeInTheDocument();
expect(screen.getByText(/you're all caught up/i)).toBeInTheDocument();
});
});
13 changes: 11 additions & 2 deletions quotevote-frontend/src/__tests__/components/Chat/ChatList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,19 @@
jest.mock('@/components/Avatar', () => ({
__esModule: true,
default: ({ src, alt }: { src?: string; alt: string }) => (
<img data-testid="avatar" src={src} alt={alt} />

Check warning on line 37 in quotevote-frontend/src/__tests__/components/Chat/ChatList.test.tsx

View workflow job for this annotation

GitHub Actions / Frontend CI

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
),
}))

// ─── DisplayAvatar mock (used by ChatList) ─────────────────────────────────
jest.mock('@/components/DisplayAvatar', () => ({
__esModule: true,
DisplayAvatar: ({ avatar, username }: { avatar?: string | Record<string, unknown>; username: string; size?: number; className?: string }) => {
const src = typeof avatar === 'string' ? avatar : `https://avataaars.io/?seed=${username}`
return <img data-testid="avatar" src={src} alt={`${username}'s avatar`} />

Check warning on line 46 in quotevote-frontend/src/__tests__/components/Chat/ChatList.test.tsx

View workflow job for this annotation

GitHub Actions / Frontend CI

Using `<img>` could result in slower LCP and higher bandwidth. Consider using `<Image />` from `next/image` or a custom image loader to automatically optimize images. This may incur additional usage or cost from your provider. See: https://nextjs.org/docs/messages/no-img-element
},
}))

// ─── LoadingSpinner mock ───────────────────────────────────────────────────
jest.mock('@/components/LoadingSpinner', () => ({
LoadingSpinner: ({ size }: { size: number }) => (
Expand Down Expand Up @@ -328,8 +337,8 @@
render(<ChatList filterType="chats" />)

await waitFor(() => {
// When no avatar, the first letter of the room title is displayed
expect(screen.getByText('J')).toBeInTheDocument()
// When no avatar, DisplayAvatar still renders a cartoon avatar image
expect(screen.getByTestId('avatar')).toBeInTheDocument()
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,16 @@ jest.mock('@/components/Avatar', () => ({
),
}))

// Mock DisplayAvatar component (used by MessageItem)
jest.mock('@/components/DisplayAvatar', () => ({
__esModule: true,
DisplayAvatar: ({ username, size }: { avatar?: unknown; username: string; size: number; className?: string }) => (
<div data-testid="avatar" data-username={username} data-size={size}>
DisplayAvatar
</div>
),
}))

jest.mock('@/hooks/useGuestGuard', () => ({
__esModule: true,
default: () => () => true,
Expand Down
Loading
Loading