Files
ToBePlayed-Frontend/src/components/CurrentlyPlayingCard.test.jsx
T
lobo 9adc606c57 feat(library): show set total playtime on dashboard cards
Most played and currently playing cards show the total playtime of
the game set. Use the own minutes when the API sends no total.
2026-10-09 14:35:07 +02:00

19 lines
733 B
React

// @vitest-environment jsdom
import {afterEach, describe, expect, it, vi} from 'vitest';
import {cleanup, render, screen} from '@testing-library/react';
import {MemoryRouter} from 'react-router-dom';
import CurrentlyPlayingCard from './CurrentlyPlayingCard.jsx';
vi.mock('react-i18next', () => import('../test/i18n-mock.js'));
describe('CurrentlyPlayingCard', () => {
afterEach(cleanup);
it('shows the set total of a game, not the minutes of its own row', () => {
render(<MemoryRouter><CurrentlyPlayingCard games={[{appid: 620, name: 'Portal 2', playtimeMinutes: 100,
totalPlaytimeMinutes: 600, status: 'PLAYING'}]}/></MemoryRouter>);
expect(screen.getByText('10h')).toBeTruthy();
});
});