test(ShipmentFilters): add component test suite — issue #615 - #642
Merged
Conversation
…615) - Renders without crashing, verifies onFilterChange called on mount - Status chip toggle: selects and deselects, asserts callback payload - Date range filter: opens picker, picks two days, applies, asserts dateFrom/dateTo - Clear All Filters button resets all values to EMPTY_FILTERS - Individual chip remove via active-filter strip - Accessibility: role/placeholder queries for all filter controls - Active filter count badge reflects applied filter count - Clear All chip-strip button path also tested Uses MemoryRouter for useSearchParams, real timers + act(flushDebounce) for 300ms debounce, userEvent for chip clicks, vi.fn() spies throughout. No any types.
|
@Demilade10 is attempting to deploy a commit to the dinahmaccodes' projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Closes #615
Description
Adds a Vitest + React Testing Library test suite for the
ShipmentFilterscomponent at
frontend/src/pages/Shipments/ShipmentFilters/ShipmentFilters.test.tsx.9 tests covering all 6 acceptance criteria from the issue:
onFilterChangecalled on mountdateFrom/dateToin callbackgetByRole/getByPlaceholderTextImplementation notes:
MemoryRouterwraps the component to satisfyuseSearchParams— no mocking neededawait act(flushDebounce)(350 ms) handle the component's 300 ms debounceuserEventfor all chip/button interactions;fireEvent.changefor text inputsvi.fn()spies ononFilterChangethroughoutanytypesTesting
pnpm run lint— no errors in new file (pre-existing errors in other files unrelated to this PR)pnpm run build— pre-existing build errors in unrelated files; new file introduces nonepnpm run test "ShipmentFilters"— 9/9 tests passScreenshots/Recording