feat(stats): add chart form selection and pie, donut, line charts
Build, Test & Push Frontend / quality-check (push) Successful in 30s
Build, Test & Push Frontend / docker (push) Successful in 22s

Tag rows with 0 games are no longer clickable.
This commit is contained in:
lobo committed 2026-10-04 10:43:02 +02:00
1 parent 8b94a25844
commit e054e13a59
21 files changed
+815 -56

No files matched your search

+15
View File
@@ -96,6 +96,21 @@ describe('Dashboard', () => {
expect(fetch).toHaveBeenCalledWith(expect.stringMatching(/\/api\/library\/stats\?groups=HABITS,TREND$/), expect.anything());
});
it('showsAStatTileInTheChartFormOfTheUser', async () => {
fetchRoutes({
...dashboardRoutes({dashboardTiles: [{id: 'STATS_FINISHED', size: 'M'}], statCharts: {FINISHED: 'LINE'}}),
'GET /api/library/stats': json(200, {trend: null, finished: {finishedBeforeTracking: 0,
perYear: [{year: 2022, games: 3}, {year: 2024, games: 1}]}}),
});
renderDashboard();
expect(await screen.findByRole('button', {name: /2022/})).toBeTruthy();
expect(screen.getByRole('button', {name: /2024/})).toBeTruthy();
expect(screen.getByText('2023: 0')).toBeTruthy();
expect(screen.queryByRole('button', {name: /2023/})).toBeNull();
expect(screen.queryByRole('group', {name: 'STATS.CHART.LABEL'})).toBeNull();
});
it('leaves out a stat tile whose data did not come', async () => {
const container = mockDashboard({dashboardTiles: [{id: 'STATS_PILE', size: 'M'}, {id: 'MOST_PLAYED', size: 'M'}]});