web-player: split player, navigation and accent state into focused modules
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { findTopResult } from './search';
|
||||
import { findTopResult, searchChips } from './search';
|
||||
|
||||
const empty = { tracks: [], albums: [], playlists: [], users: [] };
|
||||
|
||||
@@ -26,3 +26,17 @@ describe('findTopResult', () => {
|
||||
expect(findTopResult({ ...empty, query: 'x' })).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('searchChips', () => {
|
||||
it('adds an "all" chip with the total', () => {
|
||||
const chips = searchChips({ tracks: 3, albums: 2, playlists: 0, users: 1 });
|
||||
expect(chips.map((chip) => [chip.filter, chip.count])).toEqual([
|
||||
['all', 6],
|
||||
['tracks', 3],
|
||||
['albums', 2],
|
||||
['playlists', 0],
|
||||
['users', 1]
|
||||
]);
|
||||
expect(chips[0].label).toBe('Todo');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user