Widget tests for both UI components
epic-pause-status-notifications-ui-task-008 — Write Flutter widget tests for PauseNotificationCard and PeerMentorConfirmationBanner. For the card: verify mentor name, effective date, optional reason, and quick-action link render correctly with mock data; assert the profile deep-link tap emits the correct navigation event. For the banner: verify correct message text for both pause and resume states, confirm auto-dismiss fires after the configured delay, and assert the widget is removed from the tree after dismissal.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 4 - 323 tasks
Can start after Tier 3 completes
Implementation Notes
Group tests by widget in separate `group()` blocks for clarity. Create a shared `buildTestWidget` helper for each component that wraps it in `MaterialApp` with the app's design token theme to avoid token-not-found runtime errors during tests. For the auto-dismiss test: wrap the test in `fakeAsync`, pump the widget, advance time by `PeerMentorConfirmationBannerModel.autoDismissDuration`, then pump again and assert `onDismiss` was called. To test widget removal from tree: use a `StatefulWidget` wrapper in the test that removes the banner from the build output when `onDismiss` fires, then assert `find.byType(PeerMentorConfirmationBanner).evaluate().isEmpty`.
Avoid `pumpAndSettle` with timers — use explicit `pump(duration)` calls instead.
Testing Requirements
Flutter widget tests only (no integration tests in this task). Use `flutter_test` with `WidgetTester`. Use `fakeAsync` + `FakeAsync.elapse()` for timer-dependent banner tests. Mock navigation callbacks with captured `VoidCallback` / argument matchers.
Use `find.text`, `find.byType`, and `find.byKey` for assertions. Golden tests are optional but recommended for visual regression on both states of the banner. Accessibility: run `SemanticsHandle` checks to confirm semantic labels are present on interactive elements.
The existing notification feed component may expect a specific notification model shape that does not map cleanly to the pause notification payload structure, requiring either payload transformation or feed refactoring.
Mitigation & Contingency
Mitigation: Review the notification-list-item and notification-model contracts before building the card. Design the pause-notification-card to extend or wrap the existing list item pattern rather than replacing it.
Contingency: If the feed contract is incompatible, implement a lightweight adapter that maps the pause notification payload to the feed's expected model shape, keeping the adapter isolated from the core card widget.
The app's existing toast/banner infrastructure may not support the auto-dismiss timeout duration or dismissal animation required for the peer mentor confirmation banner, necessitating a custom implementation that diverges from the design system.
Mitigation & Contingency
Mitigation: Audit the existing banner and toast components (in-app-notification-banner, notification-list-item) for configurable dismiss timeout before starting implementation. Prefer configuration over custom code.
Contingency: If the existing infrastructure cannot be configured, implement the banner as a thin wrapper with a custom auto-dismiss timer while reusing all visual tokens (colours, spacing, typography) from the design system to maintain consistency.