Unit test all six UI widgets
epic-peer-mentor-detail-screen-ui-components-task-013 — Write flutter_test widget tests for all six components in this epic: OrgLabelsProvider (stream emission, fallback), CertificationStatusBadge (all three states, both sizes), CertificationAlertBanner (HLF shown, non-HLF hidden, countdown accuracy), PeerMentorProfileHeader (avatar, fallback initials, error state), AssignedContactsList (populated, empty state, Blindeforbundet badge), and MentorActivitySummaryPanel (with data, empty state, tap callback). Target 80%+ branch coverage.
Acceptance Criteria
Technical Requirements
Execution Context
Tier 4 - 323 tasks
Can start after Tier 3 completes
Implementation Notes
Group all tests under a single `group('PeerMentorDetailScreen UI Widgets', ...)` with nested groups per widget. For image-loading tests in PeerMentorProfileHeader, register a fake `HttpClientRequest` or use the `FakeHttpClient` approach so network image tests are hermetic. For the CertificationAlertBanner countdown, inject a `DateTime now` parameter or use a `Clock` abstraction so tests can set a fixed reference date without `DateTime.now()`. Avoid snapshot-style string matching on rendered text; prefer `find.text(...)` with exact strings derived from the same constants the widgets use, to prevent brittle tests.
Ensure each test file imports only from the `lib/` barrel — never from other test files.
Testing Requirements
Exclusively widget tests using flutter_test. Organize tests in one file per widget or a single grouped file (group() per widget). Use `testWidgets` for all cases. Inject dependencies via constructor parameters or InheritedWidget/Provider fakes — do not rely on global singletons.
Use `StreamController` fakes for OrgLabelsProvider stream tests. Use `FakeAsync` / `tester.pump(Duration(...))` for countdown timer assertions. After all tests pass, run `flutter test --coverage` and generate lcov report; assert total branch coverage ≥80% in CI via `lcov --summary`.
The org labels system may not yet have label keys defined for peer mentor detail screen terminology (role labels, section headings), requiring additions to the label key registry that must be coordinated with the admin configuration team.
Mitigation & Contingency
Mitigation: Audit existing label keys in the terminology system before starting OrgLabelsProvider integration. Submit required new label keys for admin configuration in parallel with component implementation.
Contingency: If label keys are not available at integration time, use hardcoded English fallbacks with a clear TODO for admin configuration, ensuring the widget renders correctly while keys are being provisioned.
The design token semantic colors (warning, error surface) may not meet WCAG 2.2 AA 4.5:1 contrast ratio when rendered on the app's background surface tokens, requiring design system changes that affect the entire app.
Mitigation & Contingency
Mitigation: Run contrast ratio validation on the token palette during Epic 1 design token implementation. Flag any failing pairs to the design system owner before building UI components that depend on them.
Contingency: If tokens fail contrast requirements, define supplementary high-contrast override tokens specific to alert and badge contexts that meet AA without modifying the global palette.