Description
components/disputes/DisputePanel.tsx (DisputePanel) is a state-machine container that renders one of five views — none, open, voting, ended, executed — from NoneState, OpenState, VotingState, EndedState, and ExecutedState under components/disputes/states/, and accepts an optional onStateChange callback. The shared primitives (TallyBar, CountdownTimer, WarningBanner, DetailsAccordion) already have tests under components/disputes/shared/__tests__/, but DisputePanel, DisputeStateBadge, and the five state views have none. This issue closes that gap using the existing mock fixtures in components/disputes/mock-data.ts.
Requirements and context
- Add
components/disputes/__tests__/DisputePanel.test.tsx driving the panel with mockNoneDispute, mockOpenDispute, mockVotingDispute, mockEndedDispute, and mockExecutedDispute from components/disputes/mock-data.ts.
- Assert the correct state view renders for each
DisputeData input and that DisputeStateBadge shows the matching label/state.
- Cover at least one state transition (e.g.
none to open) and assert onStateChange fires with the new state.
- Non-functional: control time for any
CountdownTimer rendered inside states with fake timers so deadlines do not cause flakiness.
- Follow the conventions in
components/disputes/shared/__tests__/TallyBar.test.tsx and CountdownTimer.test.tsx.
Acceptance criteria
Suggested execution
1. Fork the repo and create a branch — git checkout -b feature/dispute-panel-tests.
2. Implement changes — add tests under components/disputes/__tests__/; reuse fixtures from components/disputes/mock-data.ts.
3. Write/extend tests — Jest + React Testing Library with pnpm; mirror the sibling shared/__tests__/ style (describe/it, role queries, fake timers for countdowns).
4. Test and commit —
pnpm install
pnpm test
pnpm test:coverage
pnpm lint
Example commit message
test(disputes): cover DisputePanel state machine and the five state views
Guidelines
- Raise coverage for the disputes state-machine files from 0% to >=85% line coverage.
- Keep assertions accessibility-aware (the states already expose ARIA roles via shared components); document any missing labels.
- Timeframe: 96 hours.
Description
components/disputes/DisputePanel.tsx(DisputePanel) is a state-machine container that renders one of five views —none,open,voting,ended,executed— fromNoneState,OpenState,VotingState,EndedState, andExecutedStateundercomponents/disputes/states/, and accepts an optionalonStateChangecallback. The shared primitives (TallyBar,CountdownTimer,WarningBanner,DetailsAccordion) already have tests undercomponents/disputes/shared/__tests__/, butDisputePanel,DisputeStateBadge, and the five state views have none. This issue closes that gap using the existing mock fixtures incomponents/disputes/mock-data.ts.Requirements and context
components/disputes/__tests__/DisputePanel.test.tsxdriving the panel withmockNoneDispute,mockOpenDispute,mockVotingDispute,mockEndedDispute, andmockExecutedDisputefromcomponents/disputes/mock-data.ts.DisputeDatainput and thatDisputeStateBadgeshows the matching label/state.nonetoopen) and assertonStateChangefires with the new state.CountdownTimerrendered inside states with fake timers so deadlines do not cause flakiness.components/disputes/shared/__tests__/TallyBar.test.tsxandCountdownTimer.test.tsx.Acceptance criteria
components/disputes/__tests__/DisputePanel.test.tsxexists and passes underpnpm test.DisputeStateBadgelabel is asserted for every state.onStateChangecallback payload.DisputePanel.tsxandcomponents/disputes/states/*reaches >=85% lines.Suggested execution
1. Fork the repo and create a branch —
git checkout -b feature/dispute-panel-tests.2. Implement changes — add tests under
components/disputes/__tests__/; reuse fixtures fromcomponents/disputes/mock-data.ts.3. Write/extend tests — Jest + React Testing Library with pnpm; mirror the sibling
shared/__tests__/style (describe/it, role queries, fake timers for countdowns).4. Test and commit —
pnpm install pnpm test pnpm test:coverage pnpm lintExample commit message
Guidelines