Skip to content

Commit 8b8edc7

Browse files
jaggederestclaude
andcommitted
test: consolidate test mocks into reusable factories
- Create comprehensive mock factories in test-helpers.ts - Storage variants (with auth, minimal) - Workspace variants (running, stopped, failed, with build) - VSCode components (RemoteSSH, TreeView, StatusBar, QuickPick, Terminal, OutputChannel) - Provider factories (WorkspaceProvider, TreeDataProvider) - Other utilities (Remote, Commands, EventEmitter, Axios, ProxyAgent, Uri) - Migrate all test files to use mock factories - api.test.ts: Replace inline process/WebSocket mocks, use createMockApi - commands.test.ts: Replace all inline mocks with factories - extension.test.ts: Consolidate context, provider, and remote mocks - workspaceMonitor.test.ts: Use getPrivateProperty helper, eliminate inline mocks - workspacesProvider.test.ts: Replace vscode module mock with factory - inbox.test.ts: Remove type casting patterns - headers.test.ts: Use createMockConfiguration - remote.test.ts: Update Storage mock to use factory - Improve test quality and maintainability - Reduce 'as any' casts from 95 to 4 (96% reduction) - Eliminate all inline mock object definitions - Remove unsafe type casting patterns - Centralize mock creation logic - All 405 tests passing with 78.49% coverage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8505c4f commit 8b8edc7

File tree

11 files changed

+1605
-1105
lines changed

11 files changed

+1605
-1105
lines changed

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ Current status: **74.35% overall unit test coverage** with 359 unit tests and 69
4444

4545
### Testing Priority Framework
4646

47-
1. **Files with <50% coverage** need immediate attention (remote.ts: 49.21%, extension.ts: 38.68%)
47+
1. **Files with <50% coverage** need immediate attention (remote.ts: 49.51%)
4848
2. **Add incremental tests** - focus on measurable progress each session
4949
3. **Target coverage improvements** of 5-15 percentage points per file
5050
4. **ALWAYS use `yarn test:ci --coverage`** - never test individual files
51+
5. **Ignore coverage for test-helpers.ts** - this is a test utility file containing mock factories and helper functions
5152

5253
### Testing Patterns to Follow
5354

0 commit comments

Comments
 (0)