mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 07:15:47 +00:00
fix(mix): rating filter across mixes and Lucky Mix queue fill (#714)
* fix(mix): apply rating filter across mixes and fix Lucky Mix queue fill Invalidate entity rating cache on setRating and stop negative-caching unrated artists/albums so filters see fresh stars. Honor UI rating overrides, wire Instant Mix and CLI paths, fix Random Mix filter order, and align Lucky Mix progress with the real player queue length. * docs(changelog): document mix rating filter and Lucky Mix queue fix
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import type { SubsonicSong } from '../../api/subsonicTypes';
|
||||
import { filterRandomMixSongs } from './randomMixHelpers';
|
||||
|
||||
function song(id: string): SubsonicSong {
|
||||
return {
|
||||
id,
|
||||
title: 't',
|
||||
artist: 'A',
|
||||
album: 'Al',
|
||||
albumId: 'alb',
|
||||
duration: 1,
|
||||
artistUserRating: 1,
|
||||
};
|
||||
}
|
||||
|
||||
describe('filterRandomMixSongs', () => {
|
||||
it('applies mix rating filter even when audiobook exclusion is off', () => {
|
||||
const cfg = { enabled: true, minSong: 0, minAlbum: 0, minArtist: 2 };
|
||||
const out = filterRandomMixSongs([song('1'), song('2')], {
|
||||
excludeAudiobooks: false,
|
||||
customGenreBlacklist: [],
|
||||
mixRatingCfg: { ...cfg, minArtist: 2 },
|
||||
});
|
||||
expect(out).toHaveLength(0);
|
||||
|
||||
const kept = filterRandomMixSongs([song('1'), { ...song('2'), artistUserRating: 4 }], {
|
||||
excludeAudiobooks: false,
|
||||
customGenreBlacklist: [],
|
||||
mixRatingCfg: cfg,
|
||||
});
|
||||
expect(kept).toHaveLength(1);
|
||||
expect(kept[0].id).toBe('2');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user