diff --git a/e2e-tests/games.spec.ts b/e2e-tests/games.spec.ts index d447f1e..0cbe4fd 100644 --- a/e2e-tests/games.spec.ts +++ b/e2e-tests/games.spec.ts @@ -22,6 +22,11 @@ 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 game cards display their rating', async () => { + const gameCards = page.getByTestId('game-card'); + await expect(gameCards.first().getByTestId('game-rating')).toBeVisible(); + }); }); test('should navigate to correct game details page when clicking on a game', async ({ page }) => { diff --git a/src/components/GameCard.astro b/src/components/GameCard.astro index da71b54..2899d87 100644 --- a/src/components/GameCard.astro +++ b/src/components/GameCard.astro @@ -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 { @@ -37,6 +38,16 @@ const { game } = Astro.props; )} +
+ {game.starRating === null ? ( + + No rating yet + + ) : ( + + )} +
+

{game.description}