Skip to content

tests(useCloseToBackground): mock sync APIs and add focus/resume and stop-on-hide tests#56

Merged
QingJ01 merged 1 commit into
masterfrom
codex/investigate-failed-release-0.1.1
Jun 3, 2026
Merged

tests(useCloseToBackground): mock sync APIs and add focus/resume and stop-on-hide tests#56
QingJ01 merged 1 commit into
masterfrom
codex/investigate-failed-release-0.1.1

Conversation

@QingJ01

@QingJ01 QingJ01 commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Ensure the window-close-to-background behavior properly stops and resumes account synchronization and respects realtime mode and poll interval settings.

Description

  • Add mocks for startSync and stopSync and a useAccountsQuery mock so tests can assert per-account sync calls.
  • Mock the window onFocusChanged handler and extend the mocked uiState with pollInterval and realtimeMode, and refactor useUIStore mock to use a selector-based getState.
  • Add assertions that stopSync is called for each account when the app is hidden instead of closed.
  • Add tests that startSync is invoked with each account and the configured pollInterval when the hidden window regains focus, and that no resume occurs when realtimeMode is manual.

Testing

  • Ran the updated unit tests for tests/app/useCloseToBackground.test.tsx with vitest, and they passed.
  • Ran the test suite including the updated mocks and focused scenarios, and all related tests passed.

Codex Task

@QingJ01 QingJ01 merged commit 13a2886 into master Jun 3, 2026
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant