feat(web): add search query helpers (summary + 3 facet infinite queries)
createSearchQuery hits /api/search with limit=10 (the main /search page summary). createSearchArtistsInfiniteQuery / createSearchAlbumsInfiniteQuery / createSearchTracksInfiniteQuery each hit /api/search with limit=50 and project to their own facet, used by the per-facet overflow pages. All four are gated by q.length > 0 so empty queries don't fire.
This commit is contained in:
@@ -15,3 +15,18 @@ describe('qk key generators', () => {
|
||||
expect(qk.album('xyz')).toEqual(['album', 'xyz']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('qk search keys', () => {
|
||||
test('search summary key includes q', () => {
|
||||
expect(qk.search('foo')).toEqual(['search', { q: 'foo' }]);
|
||||
});
|
||||
test('searchArtists key includes q', () => {
|
||||
expect(qk.searchArtists('foo')).toEqual(['searchArtists', { q: 'foo' }]);
|
||||
});
|
||||
test('searchAlbums key includes q', () => {
|
||||
expect(qk.searchAlbums('foo')).toEqual(['searchAlbums', { q: 'foo' }]);
|
||||
});
|
||||
test('searchTracks key includes q', () => {
|
||||
expect(qk.searchTracks('foo')).toEqual(['searchTracks', { q: 'foo' }]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user