LifeMate — Personal, Family & Learning Companion
docs/offline-data-rescue-options
chore/phase1-repository-cleanup
deploy/stable-web-apk
deployment-static
design/mobile-accessibility-v2
design/mobile-navigation-review
docs/child-education-access-decision
docs/offline-data-rescue-options
docs/owner-guide-and-delivery-plan
docs/phase1-policy-options
docs/public-review-live-2026-10-15
feat/aparat-learning-library
feat/child-device-safety
feat/child-identity-schema
feat/flutter-mobile-navigation
feat/learning-content-operations
feat/local-signing-preflight
feat/online-family-stage0
feat/personal-encrypted-recovery
feat/private-planner-series-api
feat/public-review-page
feat/standalone-weekly-planner
feat/weekly-planner-android
final-feature-1/iran-family-school
fix/auth-abuse-expiry-safety
fix/auth-expiry-after-lock
fix/backend-request-safety
fix/lifeguide-bootstrap-naming-ci
fix/lifeguide-pages-qa-base-preflight
fix/lifeguide-qa-pages-env-deployment
fix/local-task-persistence
fix/managed-child-session-boundary
fix/personal-jalali-dates
fix/personal-notification-controls
fix/personal-upgrade-delivery-guard
fix/sms-approval-gates
fix/study-duration-display
infra/cloudflare-neon-migration
infra/lifeguide-cloudflare-qa
infra/lifeguide-github-pages-qa
infra/lifeguide-supabase-qa
main
phase-1/foundation-completion
phase-2/product-foundation-identity
phase-3/planner-school-family-core
phase-4/ai-learning-wellbeing
phase-5/hardening-observability-release
test/android-reminder-acceptance
test/personal-notification-settings
test/personal-recovery-acceptance
test/role-entry-apk
| 1 | import 'package:flutter_test/flutter_test.dart'; |
| 2 | import 'package:lifemate/device_reminder_preferences.dart'; |
| 3 | import 'package:shared_preferences_platform_interface/in_memory_shared_preferences_async.dart'; |
| 4 | import 'package:shared_preferences_platform_interface/shared_preferences_async_platform_interface.dart'; |
| 5 | |
| 6 | void main() { |
| 7 | TestWidgetsFlutterBinding.ensureInitialized(); |
| 8 | setUp(() { |
| 9 | SharedPreferencesAsyncPlatform.instance = |
| 10 | InMemorySharedPreferencesAsync.withData({}); |
| 11 | }); |
| 12 | test('nickname persists in its user and API scope only', () async { |
| 13 | final store = DeviceReminderPreferences(); |
| 14 | await store.write('https://one.invalid|synthetic-user-a', 'همراه من'); |
| 15 | expect( |
| 16 | await DeviceReminderPreferences() |
| 17 | .read('https://one.invalid|synthetic-user-a'), |
| 18 | 'همراه من'); |
| 19 | expect( |
| 20 | await store.read('https://one.invalid|synthetic-user-b'), 'LifeGuide'); |
| 21 | expect( |
| 22 | await store.read('https://two.invalid|synthetic-user-a'), 'LifeGuide'); |
| 23 | }); |
| 24 | test( |
| 25 | 'nickname validation retains joined emoji and rejects controls or excess', |
| 26 | () async { |
| 27 | final store = DeviceReminderPreferences(); |
| 28 | final joined = List.filled(40, '👩🔬').join(); |
| 29 | await store.write('synthetic-scope', joined); |
| 30 | expect(await store.read('synthetic-scope'), joined); |
| 31 | for (final invalid in ['$joined!', 'bad\nname']) { |
| 32 | await expectLater( |
| 33 | store.write('synthetic-scope', invalid), throwsArgumentError); |
| 34 | } |
| 35 | expect(await store.read('synthetic-scope'), joined); |
| 36 | }); |
| 37 | } |