.maestro/playbooks/Wizard-2026-02-22-2/Phase-02-Toast-Notification-Tests.md
This phase creates a comprehensive unit test suite for the ToastNotifier module. Tests verify the setting toggle, platform guard, error resilience, and correct notification content — ensuring the feature is robust without manual QA.
Create ToastNotifier unit tests:
tests/services/worker/agents/ToastNotifier.test.tstests/services/worker/agents/ for import patterns and test conventions before writingnode-notifier using vi.mock('node-notifier', ...) — the mock should capture calls to notify()SettingsDefaultsManager.loadFromFile to control the CLAUDE_MEM_TOAST_NOTIFICATIONS_ENABLED settingsends notification when enabled on macOS — set platform to darwin, setting to 'true', call sendObservationToast('Title', 'Subtitle'), assert notifier.notify was called with matching title and messagedoes not send notification when disabled — set setting to 'false', call function, assert notifier.notify was NOT calleddoes not send notification on non-macOS platforms — mock process.platform to 'linux', set setting to 'true', call function, assert notifier.notify was NOT calledhandles null title gracefully — call with (null, 'subtitle'), assert notify was called with fallback titlehandles null subtitle gracefully — call with ('title', null), assert notify was called with empty messagedoes not throw when notifier errors — make notifier.notify throw, assert sendObservationToast does not throwvi.spyOn on the process object or store/restore Object.defineProperty(process, 'platform', ...)Run ToastNotifier tests and fix any failures:
npx vitest run tests/services/worker/agents/ToastNotifier.test.tsRun the full test suite to verify no regressions:
npx vitest runCLAUDE_MEM_TOAST_NOTIFICATIONS_ENABLED: 'false'