high priority low complexity testing pending testing specialist Tier 6

Acceptance Criteria

Test suite has at least one test per partner organization (NHF, Blindeforbundet, HLF, Barnekreftforeningen) asserting org-specific label overrides
For each org, at least two label keys are asserted: one that has an org-specific override and one that falls back to the default
Fallback test confirms that when a label key has no org-specific override the default terminology string is returned (not null, not empty)
Reactive rebuild test: setting a new active organization in the ProviderContainer causes OrgLabelsProvider to return the new org's labels on the next read
getLabelOrDefault() never throws for any string key, including empty string and keys containing special characters
All tests pass with zero analyzer warnings in flutter_test
ProviderContainer is disposed in tearDown() to prevent test pollution
Tests do not depend on any real Supabase connection or file I/O

Technical Requirements

frameworks
flutter_test
Riverpod (ProviderContainer)
mockito or mocktail
apis
OrgLabelsProvider Riverpod provider
OrgSelectionService mock or stub
data models
OrgLabels (per-org label map)
Organization
OrgLabelsProvider
performance requirements
Full test suite completes in under 1 second
security requirements
No real org data or PII in test fixtures

Execution Context

Execution Tier
Tier 6

Tier 6 - 158 tasks

Can start after Tier 5 completes

Implementation Notes

OrgLabelsProvider likely reads from a static label map keyed by org id. In tests, override the active organization provider to inject each org id in turn rather than testing with production Supabase data. Keep label key constants in a shared file (e.g., label_keys.dart) so tests reference the same keys as production code — avoids typo-induced false passes. For the reactive test, if OrgLabelsProvider is a StateNotifier or AsyncNotifier, use container.updateOverrides() or re-create the container with a different org override.

Ensure getLabelOrDefault accepts a defaultValue parameter that is returned when the key is absent, guaranteeing the no-throw contract.

Testing Requirements

Unit tests with flutter_test and Riverpod ProviderContainer. Each test creates a fresh ProviderContainer with overrides for the active organization. Use container.read(orgLabelsProvider) to retrieve labels. For the reactive rebuild test, use container.listen() or update the overridden OrgSelectionService state and re-read the provider to verify the new value.

Group tests: 'org-specific overrides', 'fallback to default', 'reactive rebuild on org change', 'getLabelOrDefault safety'. Assert exact string equality for known label keys. Assert no throw using expect(() => provider.getLabelOrDefault('unknown_key_xyz'), returnsNormally).

Component
Organization Labels Provider
infrastructure low
Epic Risks (2)
high impact medium prob technical

The OrgLabelsProvider must be fully initialized before any UI widget renders organization-specific text. If the service triggers label initialization asynchronously and the UI builds before the labels stream emits, widgets will briefly display raw label keys instead of human-readable text, which constitutes a WCAG 2.2 AA failure for screen readers that announce whatever text is present at render time.

Mitigation & Contingency

Mitigation: Design the OrgSelectionService.select() method to await OrgLabelsProvider initialization before completing its Future — callers receive a resolved future only after labels are ready. Use an AsyncValue loading state to gate UI rendering via Riverpod's when() pattern.

Contingency: If awaiting initialization causes perceivable UI lag, implement an optimistic render with a skeleton loading state that is announced by the live-region-announcer as 'Loading organization content' so screen readers do not announce raw keys.

medium impact medium prob integration

If the label definitions loaded from the backend for each organization do not match the label key registry used in the UI, widgets will fall back to raw keys silently. This is particularly harmful for Blindeforbundet users relying on VoiceOver, where a raw key announced by a screen reader is incomprehensible.

Mitigation & Contingency

Mitigation: Define a compile-time label key registry (enum or const strings) and assert at OrgLabelsProvider initialization that all required keys are present in the loaded map. Log a structured warning for any missing key and substitute a human-readable fallback string rather than the raw key.

Contingency: If a label schema mismatch reaches production, the OrgLabelsProvider fallback mechanism ensures users see a reasonable English default rather than a raw key. A backend label patch can be deployed without an app release.