mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
fix(home): scope Because you listened rail to sidebar library (#964)
* fix(home): scope Because you listened rail to sidebar library Similar-artist album picks used getArtist without library filtering; session cache also ignored musicLibraryFilterVersion. Filter picks to the scoped album set and key cache/reserve by filter version. * docs(changelog): credit zunoz on Psysonic Discord for PR #964 * test: satisfy SubsonicAlbum required fields in new unit tests Fix tsc --noEmit CI: songCount and duration are required on SubsonicAlbum.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import type { SubsonicAlbum } from './subsonicTypes';
|
||||
import { filterAlbumsByScopedAlbumIds } from './subsonicLibrary';
|
||||
|
||||
const album = (id: string): SubsonicAlbum => ({
|
||||
id,
|
||||
name: id,
|
||||
artist: 'a',
|
||||
artistId: '1',
|
||||
songCount: 1,
|
||||
duration: 1,
|
||||
});
|
||||
|
||||
describe('filterAlbumsByScopedAlbumIds', () => {
|
||||
it('returns all albums when scope is unset', () => {
|
||||
const albums = [album('a'), album('b')];
|
||||
expect(filterAlbumsByScopedAlbumIds(albums, null)).toEqual(albums);
|
||||
});
|
||||
|
||||
it('keeps only albums in the scoped id set', () => {
|
||||
const albums = [album('a'), album('b'), album('c')];
|
||||
expect(filterAlbumsByScopedAlbumIds(albums, new Set(['a', 'c']))).toEqual([album('a'), album('c')]);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user