diff --git a/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx b/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx
index a87b53d..9f17d0f 100644
--- a/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx
+++ b/Frontend/src/components/ActiveGameCardInfo/ActiveGameCardInfo.tsx
@@ -1,6 +1,6 @@
import { Box, Card, CardContent, Chip, Divider, Typography } from '@mui/material'
import './ActiveGameCardInfo.css'
-import type { GameData } from '../../types/Game'
+import { type GameData, FormatPrice } from '../../types/Game'
type ActiveGameInfoProps = {
game: GameData
@@ -31,12 +31,12 @@ export default function ActiveGameCardInfo({ game }: ActiveGameInfoProps) {
className={`activeGamePrice${showOriginalPrice ? ' activeGameSalePrice' : ''}`}
component="p"
>
- {game.price.toFixed(2)} $
+ {FormatPrice(game.price)}
{showOriginalPrice && (
{game.price.toFixed(2)} $
+{FormatPrice(game.price)}
{error && ( diff --git a/Frontend/src/tests/ActiveGameCard.test.tsx b/Frontend/src/tests/ActiveGameCard.test.tsx index 20e5460..3568c1a 100644 --- a/Frontend/src/tests/ActiveGameCard.test.tsx +++ b/Frontend/src/tests/ActiveGameCard.test.tsx @@ -81,10 +81,10 @@ describe('ActiveGameCard', () => { }) await screen.findByText('-50%') - expect(screen.getByText('9.99 $').className).toContain('activeGameSalePrice') + expect(screen.getByText('$9.99').className).toContain('activeGameSalePrice') const originalPrice = container.querySelector('s.activeGameOriginalPrice')! - expect(originalPrice.textContent).toBe('Original price: 19.98 $') + expect(originalPrice.textContent).toBe('Original price: $19.98') }) it('only shows the price when the game is not on sale', async () => { @@ -94,8 +94,8 @@ describe('ActiveGameCard', () => { originalPrice: 9.99 }) - await screen.findByText('9.99 $') - expect(screen.getByText('9.99 $').className).not.toContain('activeGameSalePrice') + await screen.findByText('$9.99') + expect(screen.getByText('$9.99').className).not.toContain('activeGameSalePrice') expect(container.querySelector('.activeGameOriginalPrice')).toBeNull() expect(screen.queryByText('-0%')).toBeNull() }) diff --git a/Frontend/src/types/Game.ts b/Frontend/src/types/Game.ts index 8a26eca..7cd468e 100644 --- a/Frontend/src/types/Game.ts +++ b/Frontend/src/types/Game.ts @@ -31,3 +31,7 @@ export type PageGame = { } export type PassiveGameData = Pick