Skip to content

Commit c73c742

Browse files
jaggederestclaude
andcommitted
test: simplify test suite by removing low-value tests
Reduced test complexity while maintaining 80%+ coverage: - Removed ~2,800 lines of redundant test code - Reduced test count from 367 to 266 (27% reduction) - Coverage decreased from 83.78% to 80.78% (acceptable tradeoff) - Focused on keeping essential smoke tests and happy path coverage Key changes: - Removed Logger integration tests across multiple files - Eliminated redundant edge case tests - Kept core functionality and critical path tests - Added COVERAGE.md to track test impact analysis This makes the test suite faster and easier to maintain while still providing adequate coverage of the codebase. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fa1f576 commit c73c742

15 files changed

+505
-2710
lines changed

COVERAGE.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Test Coverage Impact Analysis
2+
3+
Baseline coverage: 83.78%
4+
5+
## Test File Impact
6+
7+
| Test File | Coverage Without File | Coverage Delta | Impact |
8+
| -------------------------- | --------------------- | -------------- | -------- |
9+
| api-helper.test.ts | 83.28% | -0.50% | Low |
10+
| api.test.ts | 78.59% | -5.19% | High |
11+
| cliManager.test.ts | 81.58% | -2.20% | Medium |
12+
| commands.test.ts | 88.12% | +4.34% | Negative |
13+
| error.test.ts | 81.53% | -2.25% | Medium |
14+
| extension.test.ts | 82.75% | -1.03% | Low |
15+
| featureSet.test.ts | 83.66% | -0.12% | Minimal |
16+
| headers.test.ts | 82.06% | -1.72% | Low |
17+
| inbox.test.ts | 83.69% | -0.09% | Minimal |
18+
| logger.test.ts | 83.08% | -0.70% | Low |
19+
| proxy.test.ts | 82.10% | -1.68% | Low |
20+
| sshConfig.test.ts | 82.94% | -0.84% | Low |
21+
| sshSupport.test.ts | 83.44% | -0.34% | Minimal |
22+
| storage.test.ts | 85.80% | +2.02% | Negative |
23+
| util.test.ts | 82.12% | -1.66% | Low |
24+
| workspaceMonitor.test.ts | 83.34% | -0.44% | Low |
25+
| workspacesProvider.test.ts | 83.92% | +0.14% | Negative |
26+
27+
## Summary
28+
29+
### High Impact Files (>2% coverage drop):
30+
31+
- **api.test.ts**: -5.19% (critical for API coverage)
32+
- **error.test.ts**: -2.25%
33+
- **cliManager.test.ts**: -2.20%
34+
35+
### Negative Impact Files (coverage increases without them):
36+
37+
- **commands.test.ts**: +4.34% (commands.ts has low coverage at 62.61%)
38+
- **storage.test.ts**: +2.02% (storage.ts has low coverage at 71.01%)
39+
- **workspacesProvider.test.ts**: +0.14%
40+
41+
### Low Impact Files (<2% coverage drop):
42+
43+
- Most other test files have minimal impact on overall coverage
44+
45+
### Recommendations:
46+
47+
1. Keep all High Impact files
48+
2. Consider removing or significantly reducing tests in Negative Impact files
49+
3. Low Impact files are candidates for test reduction based on test quality/value

src/api-helper.test.ts

Lines changed: 2 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { ErrorEvent } from "eventsource";
22
import { describe, expect, it } from "vitest";
33
import {
44
AgentMetadataEventSchema,
5-
AgentMetadataEventSchemaArray,
65
errToStr,
76
extractAgents,
87
extractAllAgents,
@@ -155,71 +154,9 @@ describe("api-helper", () => {
155154
expect(result.success).toBe(true);
156155
});
157156

158-
it.each([
159-
["wrong type for age", { age: "invalid" }],
160-
["missing error field", { error: undefined }],
161-
])("should reject event with %s", (_, overrides) => {
162-
const event = createValidMetadataEvent(overrides);
163-
const result = AgentMetadataEventSchema.safeParse(event);
164-
expect(result.success).toBe(false);
165-
});
166-
167-
it("should reject event with missing description", () => {
168-
const event = createValidMetadataEvent();
169-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
170-
delete (event as any).description;
171-
const result = AgentMetadataEventSchema.safeParse(event);
172-
expect(result.success).toBe(false);
173-
});
174-
175-
it("should handle events with error messages", () => {
176-
const event = createValidMetadataEvent({
177-
value: "",
178-
error: "Collection failed",
179-
});
157+
it("should reject invalid event", () => {
158+
const event = createValidMetadataEvent({ age: "invalid" });
180159
const result = AgentMetadataEventSchema.safeParse(event);
181-
expect(result.success).toBe(true);
182-
if (result.success) {
183-
expect(result.data.result.error).toBe("Collection failed");
184-
}
185-
});
186-
});
187-
188-
describe("AgentMetadataEventSchemaArray", () => {
189-
it.each([
190-
[
191-
"valid events",
192-
[createValidMetadataEvent(), createValidMetadataEvent({ age: 120 })],
193-
true,
194-
2,
195-
],
196-
["empty array", [], true, 0],
197-
[
198-
"invalid events",
199-
[createValidMetadataEvent({ age: "invalid" })],
200-
false,
201-
0,
202-
],
203-
])("should handle %s", (_, input, expectedSuccess, expectedLength) => {
204-
const result = AgentMetadataEventSchemaArray.safeParse(input);
205-
expect(result.success).toBe(expectedSuccess);
206-
if (result.success && expectedSuccess) {
207-
expect(result.data).toHaveLength(expectedLength);
208-
}
209-
});
210-
211-
it("should reject mixed valid and invalid events", () => {
212-
const mixedEvents = [
213-
createValidMetadataEvent(),
214-
{
215-
...createValidMetadataEvent(),
216-
description: {
217-
...createValidMetadataEvent().description,
218-
interval: "invalid",
219-
},
220-
},
221-
];
222-
const result = AgentMetadataEventSchemaArray.safeParse(mixedEvents);
223160
expect(result.success).toBe(false);
224161
});
225162
});

0 commit comments

Comments
 (0)