mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
14bdcde33f
Cluster of four small mutables in two modules:
- `src/store/radioSessionState.ts` — `radioFetching` (concurrent
fetch guard) + `currentRadioArtistId` (seed artist that survives
track advances) + `radioSessionSeenIds` (dedupe set including
HISTORY_KEEP-evicted entries, fixes issue #500).
- `src/store/infiniteQueueState.ts` — `infiniteQueueFetching`
concurrent fetch guard.
Sed-driven bulk rewrite for the >35 direct-access sites. The four
`= new Set()` resets become `clearRadioSessionSeenIds()` calls and
the `setRadioArtistId` / `enqueueRadio` actions read through
`getCurrentRadioArtistId()` instead of touching the mutable directly.
15 focused tests across the two modules.
playerStore 2867 → 2865 LOC.
30 lines
803 B
TypeScript
30 lines
803 B
TypeScript
import { afterEach, describe, expect, it } from 'vitest';
|
|
import {
|
|
_resetInfiniteQueueStateForTest,
|
|
isInfiniteQueueFetching,
|
|
setInfiniteQueueFetching,
|
|
} from './infiniteQueueState';
|
|
|
|
afterEach(() => {
|
|
_resetInfiniteQueueStateForTest();
|
|
});
|
|
|
|
describe('infiniteQueueFetching', () => {
|
|
it('starts false', () => {
|
|
expect(isInfiniteQueueFetching()).toBe(false);
|
|
});
|
|
|
|
it('round-trips through set/get', () => {
|
|
setInfiniteQueueFetching(true);
|
|
expect(isInfiniteQueueFetching()).toBe(true);
|
|
setInfiniteQueueFetching(false);
|
|
expect(isInfiniteQueueFetching()).toBe(false);
|
|
});
|
|
|
|
it('_resetInfiniteQueueStateForTest resets to false', () => {
|
|
setInfiniteQueueFetching(true);
|
|
_resetInfiniteQueueStateForTest();
|
|
expect(isInfiniteQueueFetching()).toBe(false);
|
|
});
|
|
});
|