Files
Psychotoxical-psysonic/src/features/artist/utils/openArtistRefs.ts
T
Psychotoxical 17ea96dcdb test(offline): mock useOfflineBrowseReloadToken submodule in useSongBrowseList
The offline move collapsed a single-module mock into a `@/features/offline`
barrel mock, which shadowed the real `useOfflineBrowseContext` the test relied
on. Mock the reload-token submodule directly so the barrel re-exports the stub
while the sibling context hook stays live.
2026-06-30 01:26:46 +02:00

12 lines
423 B
TypeScript

import type { SubsonicOpenArtistRef } from '../api/subsonicTypes';
/** Subsonic JSON may return one ref object instead of a one-element array. */
export function coerceOpenArtistRefs(
refs: SubsonicOpenArtistRef[] | SubsonicOpenArtistRef | undefined | null,
): SubsonicOpenArtistRef[] {
if (refs == null) return [];
if (Array.isArray(refs)) return refs;
if (typeof refs === 'object') return [refs];
return [];
}