test(filters): merge the duplicate itemFilters import (#308)
backend/tests/unit/itemFilters.test.ts had two separate import statements from ../../src/itemFilters; merged into one, with nothing else in the file changed. A companion fix to backend/src/routes/items.ts — reading the by-id route's id with the existing readId helper instead of Number(req.params.id), to close the leniency Number() introduced toward inputs like '5.0', '1e2' and '0x10' — was tried and then reverted, because backend/tests/integration/errorHandling.integration.test.ts deliberately drives that exact route with a non-numeric id to prove that asyncRoute plus the error middleware turn a rejected handler into a 500 rather than hanging the request, and readId's stricter parse would answer 404 before that mechanism ever runs, leaving the test green while silently deleting the coverage it exists for; the route now carries a comment explaining why Number() stays and pointing at #307 for giving that test another trigger before making the switch. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { parseItemFilters, FilterError } from '../../src/itemFilters';
|
||||
import { parseItemFilters, FilterError, itemFilterExpressions, ItemFilters } from '../../src/itemFilters';
|
||||
import { db } from '../../src/db';
|
||||
import { itemFilterExpressions, ItemFilters } from '../../src/itemFilters';
|
||||
|
||||
describe('parseItemFilters', () => {
|
||||
it('returns empty filters for an empty query', () => {
|
||||
|
||||
Reference in New Issue
Block a user