high priority low complexity testing pending testing specialist Tier 2

Acceptance Criteria

Test suite contains at least 8 discrete test cases matching the specification: today-expired, 30-days-expiring_soon boundary, 31-days-active, 1-day-past-expired, pause+valid-cert=paused, pause+expired-cert=paused, days_remaining correctness, custom threshold override
All tests pass with `flutter test` and produce zero failures
No test imports Supabase, http, or any network-dependent package — all dates are injected as constructor or method parameters
days_remaining is asserted to be exactly 0 when expiry equals today, positive for future dates, and negative for past dates
Pause flag tests assert that CertificationStatus.paused is returned regardless of expiry date when isPaused is true
Custom warning threshold test verifies that a threshold of, e.g., 14 days causes expiring_soon only within that window, not the default 30-day window
Test file resides in `test/services/certification_status_service_test.dart` following project test directory conventions
All test descriptions are written in English and clearly describe the scenario under test

Technical Requirements

frameworks
flutter_test
Flutter
data models
CertificationStatusService
CertificationStatus (enum: active, expiring_soon, expired, paused)
performance requirements
Full test suite must complete in under 2 seconds (pure Dart, no I/O)
security requirements
No real user data or credentials may appear in test fixtures — use synthetic dates only

Execution Context

Execution Tier
Tier 2

Tier 2 - 518 tasks

Can start after Tier 1 completes

Implementation Notes

CertificationStatusService must accept an injectable `DateTime now` parameter (or a clock abstraction) rather than calling `DateTime.now()` internally — this is the key design prerequisite for testability. If the service under test does not already support clock injection, add it before writing tests. Use `setUp()` to define a fixed 'today' reference date shared across all test cases. Boundary conditions (exactly 30 days, exactly today) are the highest-value cases; test these with off-by-one variants (29, 30, 31 days).

For the pause flag, confirm the enum precedence in the service implementation matches what the tests assert — if the service checks `isPaused` before evaluating the expiry date, the tests must reflect that order.

Testing Requirements

Unit tests only (flutter_test). No mocking of external services required. Use `DateTime` injection (pass clock as parameter or use a ClockProvider) to make date-dependent logic deterministic. Organise tests with `group()` blocks per scenario category: boundary dates, pause flag precedence, days_remaining arithmetic, threshold override.

Assert both the returned CertificationStatus enum value AND the days_remaining integer in each relevant case. Aim for 100% branch coverage of CertificationStatusService.

Epic Risks (2)
high impact medium prob integration

The design token theme extension may conflict with existing ThemeData extensions already registered in the app, causing runtime assertion errors or token resolution failures across all screens that consume the tokens.

Mitigation & Contingency

Mitigation: Audit all existing ThemeData extensions before implementation. Use a unique extension key namespace and add integration tests that instantiate the combined theme in a test app harness.

Contingency: If conflicts arise, isolate design tokens behind a dedicated provider singleton (Riverpod) rather than a ThemeData extension, updating all consuming widgets to read from the provider instead.

medium impact medium prob scope

The 30-day warning threshold for expiring_soon status may differ between HLF's stated requirement in workshops (60 days mentioned in user stories) and the 30-day value in component documentation, causing disagreement during acceptance testing.

Mitigation & Contingency

Mitigation: Explicitly confirm the threshold value with HLF stakeholder before implementation. Make the threshold a named constant (kCertificationWarnDays) so it can be updated without logic changes.

Contingency: If stakeholder confirms 60 days post-implementation, update the constant and re-run the unit test suite — no architectural change required.