-
Notifications
You must be signed in to change notification settings - Fork 24
Commit e638f58
feat: refactor remote.ts for testability and add comprehensive tests
Refactor remote.ts by extracting 5 testable helper methods:
- validateCredentials() - handles login flow and credential validation
- createWorkspaceClient() - creates workspace REST client
- setupBinary() - handles binary path setup for prod/dev modes
- validateServerVersion() - checks server compatibility and features
- fetchWorkspace() - fetches workspace with comprehensive error handling
Add remote.test.ts with 17 comprehensive test cases covering:
- Constructor and instance creation
- Credential validation and login prompts
- Binary setup for production and development modes
- Server version validation and incompatibility handling
- Workspace fetching with 404/401 error scenarios
- Remote window management (close/reload operations)
Benefits:
- Improved code maintainability through method extraction
- Reduced complexity in main setup() method
- Comprehensive error scenario testing
- Memory-efficient testing approach vs extensive mocking
- Maintains all existing functionality while enabling better testing
Total test coverage: 274 tests across 14 files (14/17 source files = 82%)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent adc144b commit e638f58Copy full SHA for e638f58
File tree
Expand file treeCollapse file tree
2 files changed
+664
-162
lines changedFilter options
- src
Expand file treeCollapse file tree
2 files changed
+664
-162
lines changed
0 commit comments