feat: add public search controls
Quality / test (push) Canceled after 0s

Add public category lookup options, allowlisted sort ordering, URL-backed catalog controls, and strict search route validation with regression tests.
This commit is contained in:
2026-09-09 01:44:28 -04:00
parent 67ce29a93e
commit f4e4685ecc
10 changed files with 71 additions and 12 deletions
@@ -41,6 +41,11 @@ test('builds a public query filter set that hides sold items by default', () =>
assert.deepEqual(filters.sort, ['recently_added']);
});
test('accepts only the supported public search sort values', () => {
assert.equal(createSearchQuery({ sort: 'price_low' }).sort, 'price_low');
assert.throws(() => createSearchQuery({ sort: 'random' }), /sort must be recent/);
});
test('normalizes whitespace and punctuation in free-text search terms', () => {
assert.equal(normalizeSearchQuery(' Pikachu #199 / holo '), 'pikachu 199 holo');
});