Public Access
Most played and currently playing cards show the total playtime of the game set. Use the own minutes when the API sends no total.
19 lines
733 B
React
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();
|
|
});
|
|
});
|