Files
psysonic/src/store/playSessionRecorded.test.ts
T
cucadmuh 23f7ba02d6 feat(player-stats): local listening history tab with heatmap and summaries (#849)
* feat(player-stats): local listening history tab with heatmap and summaries

Record play sessions in library.sqlite when the library index is enabled,
add Rust read APIs and Tauri commands for year/day aggregates, and ship the
Player stats UI with session clustering, event-driven live refresh, and a
notice when some servers are excluded from indexing.

* test(player-stats): split play_session repo and expand test coverage

Move the repository into play_session/ (completion, cluster, integration tests),
add remap/purge/FK coverage in Rust, and cover ingestion gates plus live-refresh
hooks on the frontend per spec v0.3.

* docs(release): CHANGELOG and credits for player stats (PR #849)

* fix(player-stats): satisfy tsc and clippy CI gates

Use InternetRadioStation field names in the radio skip test and replace
manual month/day range checks with RangeInclusive::contains.
2026-05-22 14:07:38 +03:00

17 lines
616 B
TypeScript

import { describe, expect, it, vi } from 'vitest';
import { emitPlaySessionRecorded, onPlaySessionRecorded } from './playSessionRecorded';
describe('playSessionRecorded', () => {
it('notifies subscribers when a listen is persisted', () => {
const listener = vi.fn();
const unsub = onPlaySessionRecorded(listener);
const detail = { serverId: 's1', trackId: 't1', startedAtMs: 123 };
emitPlaySessionRecorded(detail);
expect(listener).toHaveBeenCalledWith(detail);
unsub();
listener.mockClear();
emitPlaySessionRecorded(detail);
expect(listener).not.toHaveBeenCalled();
});
});