fix: clear-subtasks and complexity report e2e test
This commit is contained in:
@@ -131,7 +131,8 @@ describe('task-master clear-subtasks command', () => {
|
|||||||
// Verify success
|
// Verify success
|
||||||
expect(result).toHaveExitCode(0);
|
expect(result).toHaveExitCode(0);
|
||||||
expect(result.stdout).toContain('Clearing Subtasks');
|
expect(result.stdout).toContain('Clearing Subtasks');
|
||||||
expect(result.stdout).toContain('Successfully cleared subtasks from 2 task(s)');
|
// The success message appears in a decorative box with extra spaces
|
||||||
|
expect(result.stdout).toMatch(/Successfully\s+cleared\s+subtasks\s+from\s+2\s+task\(s\)/i);
|
||||||
|
|
||||||
// Read updated tasks
|
// Read updated tasks
|
||||||
const updatedTasks = JSON.parse(readFileSync(tasksPath, 'utf8'));
|
const updatedTasks = JSON.parse(readFileSync(tasksPath, 'utf8'));
|
||||||
@@ -152,7 +153,8 @@ describe('task-master clear-subtasks command', () => {
|
|||||||
// Verify success
|
// Verify success
|
||||||
expect(result).toHaveExitCode(0);
|
expect(result).toHaveExitCode(0);
|
||||||
expect(result.stdout).toContain('Clearing Subtasks');
|
expect(result.stdout).toContain('Clearing Subtasks');
|
||||||
expect(result.stdout).toContain('Successfully cleared subtasks from');
|
// The success message appears in a decorative box with extra spaces
|
||||||
|
expect(result.stdout).toMatch(/Successfully\s+cleared\s+subtasks\s+from/i);
|
||||||
|
|
||||||
// Read updated tasks
|
// Read updated tasks
|
||||||
const updatedTasks = JSON.parse(readFileSync(tasksPath, 'utf8'));
|
const updatedTasks = JSON.parse(readFileSync(tasksPath, 'utf8'));
|
||||||
|
|||||||
@@ -271,9 +271,10 @@ describe('task-master complexity-report command', () => {
|
|||||||
// Should show distribution
|
// Should show distribution
|
||||||
expect(result).toHaveExitCode(0);
|
expect(result).toHaveExitCode(0);
|
||||||
expect(result.stdout).toContain('Complexity Distribution');
|
expect(result.stdout).toContain('Complexity Distribution');
|
||||||
expect(result.stdout).toContain('Low (1-4): 3 tasks');
|
// The distribution text appears with percentages in a decorative box
|
||||||
expect(result.stdout).toContain('Medium (5-7): 5 tasks');
|
expect(result.stdout).toMatch(/Low\s*\(1-4\):\s*3\s*tasks/);
|
||||||
expect(result.stdout).toContain('High (8-10): 2 tasks');
|
expect(result.stdout).toMatch(/Medium\s*\(5-7\):\s*5\s*tasks/);
|
||||||
|
expect(result.stdout).toMatch(/High\s*\(8-10\):\s*2\s*tasks/);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle malformed report gracefully', async () => {
|
it('should handle malformed report gracefully', async () => {
|
||||||
@@ -286,10 +287,9 @@ describe('task-master complexity-report command', () => {
|
|||||||
// The command exits silently when JSON parsing fails
|
// The command exits silently when JSON parsing fails
|
||||||
expect(result).toHaveExitCode(0);
|
expect(result).toHaveExitCode(0);
|
||||||
// Output shows error message and tag footer
|
// Output shows error message and tag footer
|
||||||
const expected = result.stdout.trim();
|
expect(result.stdout).toContain('🏷️ tag: master');
|
||||||
expect(expected).toContain('🏷️ tag: master');
|
expect(result.stdout).toContain('[ERROR]');
|
||||||
expect(expected).toContain('[ERROR]');
|
expect(result.stdout).toContain('Error reading complexity report');
|
||||||
expect(expected).toContain('Error reading complexity report');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should display report generation time', async () => {
|
it('should display report generation time', async () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user