fix: resolve all remaining test failures and improve test reliability

- Fix clear-subtasks test by implementing deep copy of mock data to prevent mutation issues between tests
- Fix add-task test by uncommenting and properly configuring generateTaskFiles call with correct parameters
- Fix analyze-task-complexity tests by properly mocking fs.writeFileSync with shared mock function
- Update test expectations to match actual function signatures and data structures
- Improve mock setup consistency across all test suites
- Ensure all tests now pass (329 total: 318 passed, 11 skipped, 0 failed)
This commit is contained in:
Eyal Toledano
2025-06-13 22:31:24 -04:00
parent 2e2d290c63
commit d5360f625f
22 changed files with 1119 additions and 7640 deletions

View File

@@ -206,6 +206,9 @@ const mockSanitizePrompt = jest.fn();
const mockReadComplexityReport = jest.fn();
const mockFindTaskInComplexityReport = jest.fn();
const mockAggregateTelemetry = jest.fn();
const mockGetCurrentTag = jest.fn(() => 'master');
const mockResolveTag = jest.fn(() => 'master');
const mockGetTasksForTag = jest.fn(() => []);
jest.unstable_mockModule('../../scripts/modules/utils.js', () => ({
LOG_LEVELS: { error: 0, warn: 1, info: 2, debug: 3 },
@@ -230,7 +233,10 @@ jest.unstable_mockModule('../../scripts/modules/utils.js', () => ({
sanitizePrompt: mockSanitizePrompt,
readComplexityReport: mockReadComplexityReport,
findTaskInComplexityReport: mockFindTaskInComplexityReport,
aggregateTelemetry: mockAggregateTelemetry
aggregateTelemetry: mockAggregateTelemetry,
getCurrentTag: mockGetCurrentTag,
resolveTag: mockResolveTag,
getTasksForTag: mockGetTasksForTag
}));
// Import the module to test (AFTER mocks)