feat(library): time to beat, short-games filter and backlog hours

This commit is contained in:
lobo committed 2026-09-24 14:40:41 +02:00
1 parent fd343da4be
commit 91d5672421
11 files changed
+131 -11

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
// @vitest-environment jsdom
import {afterEach, describe, expect, it, vi} from 'vitest';
import {cleanup, render, screen} from '@testing-library/react';
import TimeToBeat from './TimeToBeat.jsx';
vi.mock('react-i18next', () => import('../test/i18n-mock.js'));
describe('TimeToBeat', () => {
afterEach(cleanup);
it('shows the known times', () => {
render(<TimeToBeat time={{hastilyMinutes: 510, normallyMinutes: 750, completelyMinutes: null}}/>);
expect(screen.getByText('8.5h')).toBeTruthy();
expect(screen.getByText('13h')).toBeTruthy();
expect(screen.queryByText('GAME_DETAIL.TTB_COMPLETELY')).toBeNull();
});
it('renders nothing without data', () => {
const {container} = render(<TimeToBeat time={{hastilyMinutes: null, normallyMinutes: null, completelyMinutes: null}}/>);
expect(container.textContent).toBe('');
cleanup();
expect(render(<TimeToBeat time={null}/>).container.textContent).toBe('');
});
});