refactor(search): simplify order by + wire reverse

This commit is contained in:
Edouard Vanbelle
2026-07-26 17:22:00 +02:00
parent e5fa234f3a
commit 87ddf8ffc8
8 changed files with 115 additions and 57 deletions
@@ -16,12 +16,12 @@ it('builds search requests including filters', async () => {
fileTypes: ['mp3', 'wav'],
minSize: 1,
maxSize: 9,
sortBy: 'date'
sortBy: 'updated_at'
}).catch(() => {});
expect(j).toHaveBeenCalledWith(expect.stringContaining('type=mp3%2Cwav'), expect.anything());
// Sort dimension is sent on the wire as `order_by`, matching the
// backend's `SearchResourcesQuery` (post-normalization).
expect(j).toHaveBeenCalledWith(expect.stringContaining('order_by=date'), expect.anything());
expect(j).toHaveBeenCalledWith(expect.stringContaining('order_by=updated_at'), expect.anything());
await searchSuggest('q').catch(() => {});
await clearSearchCache().catch(() => {});
expect(f.mock.calls.length + j.mock.calls.length).toBeGreaterThan(1);