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.
This commit is contained in:
lobo committed 2026-10-09 14:35:07 +02:00
1 parent f1a6bc0443
commit 9adc606c57
5 files changed
+44 -6

No files matched your search

@@ -0,0 +1,18 @@
// @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();
});
});