Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions e2e-tests/games.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ test.describe('Game Listing and Navigation', () => {
await expect(gameCards.first().getByTestId('game-title')).toBeVisible();
await expect(gameCards.first().getByTestId('game-title')).not.toBeEmpty();
});

await test.step('Verify every game card has a rating', async () => {
const gameCards = page.getByTestId('game-card');
await expect(page.getByTestId('game-rating')).toHaveCount(await gameCards.count());
await expect(gameCards.first().getByTestId('game-rating')).not.toBeEmpty();
});
Comment thread
tbdumpacc777-prog marked this conversation as resolved.
});

test('should navigate to correct game details page when clicking on a game', async ({ page }) => {
Expand Down
6 changes: 6 additions & 0 deletions src/components/GameCard.astro
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
import type { Game } from '../types/game';
import Tag from './Tag.astro';
import StarRating from './StarRating.astro';
import ArrowRight from '../assets/icons/arrow-right.svg';

interface Props {
Expand Down Expand Up @@ -37,6 +38,11 @@ const { game } = Astro.props;
</div>
)}

{game.starRating === null
? <p class="text-sm text-slate-400" data-testid="game-rating">No rating yet</p>
: <StarRating rating={game.starRating} />
}

<p class="text-slate-400 mb-4 text-sm line-clamp-2" data-testid="game-description">{game.description}</p>

<div class="mt-4 text-sm text-blue-400 font-medium flex items-center">
Expand Down