- Add vitest/globals to tsconfig.json types array to provide type
definitions for global test functions (describe, it, expect, vi)
- Fix vi.fn type parameter in useDirectorySettings.test.tsx from
<[], Promise<string>> to <() => Promise<string>>
- Remove unused setMcpConfig import from MSW handlers
- Add type assertions for mock.calls access in McpFormModal tests
to resolve union type inference issues
This ensures pnpm typecheck passes without errors while maintaining
test functionality with vitest globals: true configuration.
useDirectorySettings Tests:
- Test directory initialization with overrides and remote defaults
- Verify app config override with space trimming
- Load Claude/Codex directories from remote API
- Calculate resolvedDirs correctly
- Test directory browsing functionality
- Browse Claude/Codex config directories
- Browse app config directory with proper default paths
- Update settings callback when selection succeeds
- Test error handling scenarios
- User cancels directory selection (returns null)
- Directory picker throws error (shows toast)
- Verify settings not updated on failure
- Test directory reset operations
- Reset individual directories to computed defaults
- Reset app config directory
- Batch reset with provided server values
- Use vi.hoisted() for proper mock initialization
- Factory function for settings creation (reusability)
useSettingsMetadata Tests:
- Test portable mode flag loading
- Verify initial loading state
- Load portable flag from API
- Handle async state transitions
- Test error tolerance when API fails
- Silent failure on network errors
- Default to non-portable mode
- Continue without blocking UI
- Test restart flag management
- Set restart required flag
- Acknowledge restart to clear flag
- State updates wrapped in act()
All tests passing: 10/10 (7 useDirectorySettings + 3 useSettingsMetadata)