Skip to content

[Testing] Zero test coverage for NotificationPreferencesScreen — toggle, quiet-hours, and all-disable paths #144

Closed

Description

@cybermax4200

Why this matters now

The notification system is v0.2-complete and directly tied to streak reminders, reward confirmations, and the prefsStore rehydration bug (Issue 8). NotificationPreferencesScreen is the only user-facing control for notification preferences, but it has no tests at all. Any regression in toggle persistence, quiet-hours validation, or the allEnabled master switch is invisible in CI.

Problem / What

src/screens/NotificationPreferencesScreen.tsx (243 lines) contains:

  • A master enable/disable toggle backed by prefsStore.setAllEnabled
  • Per-type toggles for each NOTIFICATION_TYPES value backed by prefsStore.toggleType
  • Quiet-hours from/to time pickers backed by prefsStore.setQuietHours
  • Inline validation (from < to, valid HH:MM format)

None of these interactions have a test file. The nearest coverage is prefsStore.test.ts (which tests only the store, not the screen).

Key Challenges

  • The screen imports @notifee/react-native indirectly via prefsStore.toggleType (which cancels notifications asynchronously). The mock in __mocks__ or rn-modules.ts must be extended.
  • Quiet-hours validation involves parsing time strings; edge cases (midnight wrap 22:00–07:00, identical from/to) must be tested.
  • The component uses TouchableOpacity switches rather than platform Switch — fireEvent.press is the right interaction method.

Acceptance Criteria

  • Test file src/__tests__/NotificationPreferencesScreen.test.tsx created.
  • Tests cover: master toggle enables/disables all notifications, per-type toggle persists to store, quiet-hours update validates and persists, invalid time input shows an error.
  • All tests pass in CI with npm test.

Relevant files / functions

  • src/screens/NotificationPreferencesScreen.tsx
  • src/store/prefsStore.ts
  • src/__tests__/__mocks__/rn-modules.ts — add notifee mock if absent

Out of scope

  • Integration testing with the actual notification delivery system.
  • Testing scheduleDailyStreakReminder (separate concern).

Activity

  1. dollarop commented on Aug 28, 2026

    @dollarop

    I'd like to work on this issue. I will add focused tests for the master and
    per-type notification toggles, quiet-hours validation, persistence, and the
    all-disabled state, following the existing test patterns. Please assign me if
    this approach fits the campaign workflow.

  2. Santia2004 commented on Aug 29, 2026

    @Santia2004

    Hi! I would like to work on this issue. I have solid experience with the stack and have successfully delivered multiple PRs across the campaign. I can start immediately and deliver a clean solution with full test coverage and lint checks. Could you please assign it to me? Thanks

  3. PASdeco commented on Aug 29, 2026

    @PASdeco
    Contributor

    Hi team, I'd love to take on #144.

    I’ve worked with React Native + Jest/RNTL and Zustand (prefsStore pattern). I’ve already looked at NotificationPreferencesScreen.tsx and prefsStore.test.ts.

    My plan: create src/tests/NotificationPreferencesScreen.test.tsx covering master toggle (setAllEnabled), per-type toggles (toggleType + persistence), quiet-hours setQuietHours with HH:MM validation including midnight wrap 22:00-07:00 and identical from/to, plus invalid input error display. I’ll extend the notifee mock in rn-modules.ts for the async cancel and use fireEvent.press for the TouchableOpacity switches as noted in the issue. No integration testing, and I’ll ensure npm test passes in CI.

    Can start immediately if assigned, thanks!

  4. grantfox-oss commented on Aug 29, 2026

    @grantfox-oss

    🦊 GrantFox — @PASdeco has been assigned to this issue as part of the Third Campaign campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #144)
    2. Your PR will be reviewed by the ecotask-network maintainers

    Good luck! Track your progress on GrantFox.

  5. added a commit that references this issue on Aug 29, 2026
    2a4c3bd
  6. grantfox-oss commented on Aug 30, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox as part of the Third Campaign campaign!

    @PASdeco's PR #157 was approved and merged by @cybermax4200.

    🏆 @PASdeco: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (48 total points). Track your full progress on GrantFox.

    👏 Great work, @PASdeco! Keep contributing to ecotask-network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions