high priority low complexity testing pending testing specialist Tier 2

Acceptance Criteria

All parameterised test cases pass for Norwegian ('nb') locale returning correct title and body strings for every supported scenario type (days-inactive, certification-expiry, session-count, mentor-assigned)
All parameterised test cases pass for English ('en') locale returning correct title and body strings for every supported scenario type
daysInactive context value is correctly interpolated into the notification body string for the days-inactive scenario in both locales
sessionCount context value is correctly interpolated into the notification body string for the session-count scenario in both locales
daysToExpiry context value is correctly interpolated into the notification body string for the certification-expiry scenario in both locales
mentorFirstName context value is correctly interpolated into the notification body string for the mentor-assigned scenario in both locales
Passing an unsupported locale (e.g., 'fr', 'de', '') falls back to English output without throwing an exception
Passing an unknown/unrecognised scenario type throws a clearly typed exception (e.g., UnknownScenarioTypeException or ArgumentError) with a descriptive message
Passing null or missing context values for required interpolation fields throws an appropriate exception or returns a safe fallback string as per spec
Test file contains at least one group() block per scenario type, with nested test() or parametrised cases covering both locales
All tests run with `flutter test` in under 2 seconds with no external dependencies or async IO

Technical Requirements

frameworks
Flutter
flutter_test
data models
ScenarioType enum
NotificationContext (daysInactive, sessionCount, daysToExpiry, mentorFirstName)
NotificationContent (title, body)
performance requirements
All unit tests complete in under 2 seconds total
No async operations — all builder logic must be synchronous and testable without await
security requirements
Test data must not contain real personal data (use placeholder names like 'TestUser')
No network calls or file IO in unit tests

Execution Context

Execution Tier
Tier 2

Tier 2 - 518 tasks

Can start after Tier 1 completes

Implementation Notes

ScenarioNotificationContentBuilder is expected to be a pure Dart class with no Flutter widget dependencies, making it straightforward to test. Define a helper method buildExpected(ScenarioType type, String locale, NotificationContext ctx) inside the test file to keep assertions readable. Use expect(actual.title, expectedTitle) and expect(actual.body, expectedBody) separately so failures point to the exact field. For the exception test on unknown scenario type, wrap the call in expect(() => builder.build(...), throwsA(isA())) or a custom matcher.

Verify that the fallback-to-English test explicitly passes 'fr' and 'ar' as unsupported locales. Ensure the test file imports only dart:core and the builder's own package — no Supabase or BLoC imports.

Testing Requirements

Unit tests only using flutter_test. Use group() blocks to organise by scenario type and locale. Use a parameterised pattern (e.g., a List of input/expected tuples iterated with forEach) to avoid repetition across Norwegian and English cases. Test the full matrix: N scenario types × 2 locales = at least 8 happy-path cases.

Add negative cases for: unsupported locale fallback (at least 2 locale codes), unknown scenario type exception, and missing/null context values. Expect 100% statement coverage of ScenarioNotificationContentBuilder. No mocks required — the builder should be a pure function.

Component
Scenario Notification Content Builder
service medium
Epic Risks (3)
high impact medium prob dependency

FCM service account key and APNs certificate configuration may be missing or misconfigured in the Supabase Edge Function secrets store, blocking end-to-end push delivery testing until resolved by the infrastructure owner.

Mitigation & Contingency

Mitigation: Raise a credentials-setup task in the project board at epic start; document the exact secret names required in scenario-evaluation-config so the infrastructure owner can provision them independently of development work.

Contingency: Implement a mock push-notification-dispatcher stub that records payloads to the database for local testing, allowing the rest of the feature to proceed while credentials are obtained.

high impact low prob security

Incorrect RLS policies on the scenario_notifications or notification_preferences tables could allow one user to read or modify another user's notification records, constituting a data privacy breach.

Mitigation & Contingency

Mitigation: Write dedicated RLS policy tests using Supabase's built-in test framework before any application code touches the tables; require a peer security review of all policy definitions before merging.

Contingency: If a policy gap is discovered post-merge, immediately disable the affected table's read policy, notify the security lead, and deploy a hotfix with corrected policies before re-enabling access.

medium impact medium prob dependency

Norwegian Bokmål ARB localisation strings for all scenario message templates may not be available at implementation time, causing content-builder tests to fail and delaying integration.

Mitigation & Contingency

Mitigation: Define all required ARB message keys in a tracked document shared with the content owner at epic kickoff; use English placeholder strings that follow the final format so template injection logic can be tested independently.

Contingency: Ship with English-only strings in the first release and gate Norwegian strings behind a feature flag that is enabled once translations are reviewed and approved.