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:
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user