mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-03-19 22:53:08 +00:00
style: fix formatting with Prettier
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
/**
|
||||
* Test the task parsing logic by reimplementing the parsing functions
|
||||
@@ -88,59 +88,59 @@ function parseTasksFromSpec(specContent: string): ParsedTask[] {
|
||||
return tasks;
|
||||
}
|
||||
|
||||
describe("Task Parsing", () => {
|
||||
describe("parseTaskLine", () => {
|
||||
it("should parse task with file path", () => {
|
||||
const line = "- [ ] T001: Create user model | File: src/models/user.ts";
|
||||
describe('Task Parsing', () => {
|
||||
describe('parseTaskLine', () => {
|
||||
it('should parse task with file path', () => {
|
||||
const line = '- [ ] T001: Create user model | File: src/models/user.ts';
|
||||
const result = parseTaskLine(line);
|
||||
expect(result).toEqual({
|
||||
id: "T001",
|
||||
description: "Create user model",
|
||||
filePath: "src/models/user.ts",
|
||||
id: 'T001',
|
||||
description: 'Create user model',
|
||||
filePath: 'src/models/user.ts',
|
||||
phase: undefined,
|
||||
status: "pending",
|
||||
status: 'pending',
|
||||
});
|
||||
});
|
||||
|
||||
it("should parse task without file path", () => {
|
||||
const line = "- [ ] T002: Setup database connection";
|
||||
it('should parse task without file path', () => {
|
||||
const line = '- [ ] T002: Setup database connection';
|
||||
const result = parseTaskLine(line);
|
||||
expect(result).toEqual({
|
||||
id: "T002",
|
||||
description: "Setup database connection",
|
||||
id: 'T002',
|
||||
description: 'Setup database connection',
|
||||
phase: undefined,
|
||||
status: "pending",
|
||||
status: 'pending',
|
||||
});
|
||||
});
|
||||
|
||||
it("should include phase when provided", () => {
|
||||
const line = "- [ ] T003: Write tests | File: tests/user.test.ts";
|
||||
const result = parseTaskLine(line, "Phase 1: Foundation");
|
||||
expect(result?.phase).toBe("Phase 1: Foundation");
|
||||
it('should include phase when provided', () => {
|
||||
const line = '- [ ] T003: Write tests | File: tests/user.test.ts';
|
||||
const result = parseTaskLine(line, 'Phase 1: Foundation');
|
||||
expect(result?.phase).toBe('Phase 1: Foundation');
|
||||
});
|
||||
|
||||
it("should return null for invalid line", () => {
|
||||
expect(parseTaskLine("- [ ] Invalid format")).toBeNull();
|
||||
expect(parseTaskLine("Not a task line")).toBeNull();
|
||||
expect(parseTaskLine("")).toBeNull();
|
||||
it('should return null for invalid line', () => {
|
||||
expect(parseTaskLine('- [ ] Invalid format')).toBeNull();
|
||||
expect(parseTaskLine('Not a task line')).toBeNull();
|
||||
expect(parseTaskLine('')).toBeNull();
|
||||
});
|
||||
|
||||
it("should handle multi-word descriptions", () => {
|
||||
const line = "- [ ] T004: Implement user authentication with JWT tokens | File: src/auth.ts";
|
||||
it('should handle multi-word descriptions', () => {
|
||||
const line = '- [ ] T004: Implement user authentication with JWT tokens | File: src/auth.ts';
|
||||
const result = parseTaskLine(line);
|
||||
expect(result?.description).toBe("Implement user authentication with JWT tokens");
|
||||
expect(result?.description).toBe('Implement user authentication with JWT tokens');
|
||||
});
|
||||
|
||||
it("should trim whitespace from description and file path", () => {
|
||||
const line = "- [ ] T005: Create API endpoint | File: src/routes/api.ts ";
|
||||
it('should trim whitespace from description and file path', () => {
|
||||
const line = '- [ ] T005: Create API endpoint | File: src/routes/api.ts ';
|
||||
const result = parseTaskLine(line);
|
||||
expect(result?.description).toBe("Create API endpoint");
|
||||
expect(result?.filePath).toBe("src/routes/api.ts");
|
||||
expect(result?.description).toBe('Create API endpoint');
|
||||
expect(result?.filePath).toBe('src/routes/api.ts');
|
||||
});
|
||||
});
|
||||
|
||||
describe("parseTasksFromSpec", () => {
|
||||
it("should parse tasks from a tasks code block", () => {
|
||||
describe('parseTasksFromSpec', () => {
|
||||
it('should parse tasks from a tasks code block', () => {
|
||||
const specContent = `
|
||||
## Specification
|
||||
|
||||
@@ -157,12 +157,12 @@ Some notes here.
|
||||
`;
|
||||
const tasks = parseTasksFromSpec(specContent);
|
||||
expect(tasks).toHaveLength(3);
|
||||
expect(tasks[0].id).toBe("T001");
|
||||
expect(tasks[1].id).toBe("T002");
|
||||
expect(tasks[2].id).toBe("T003");
|
||||
expect(tasks[0].id).toBe('T001');
|
||||
expect(tasks[1].id).toBe('T002');
|
||||
expect(tasks[2].id).toBe('T003');
|
||||
});
|
||||
|
||||
it("should parse tasks with phases", () => {
|
||||
it('should parse tasks with phases', () => {
|
||||
const specContent = `
|
||||
\`\`\`tasks
|
||||
## Phase 1: Foundation
|
||||
@@ -179,20 +179,20 @@ Some notes here.
|
||||
`;
|
||||
const tasks = parseTasksFromSpec(specContent);
|
||||
expect(tasks).toHaveLength(5);
|
||||
expect(tasks[0].phase).toBe("Phase 1: Foundation");
|
||||
expect(tasks[1].phase).toBe("Phase 1: Foundation");
|
||||
expect(tasks[2].phase).toBe("Phase 2: Implementation");
|
||||
expect(tasks[3].phase).toBe("Phase 2: Implementation");
|
||||
expect(tasks[4].phase).toBe("Phase 3: Testing");
|
||||
expect(tasks[0].phase).toBe('Phase 1: Foundation');
|
||||
expect(tasks[1].phase).toBe('Phase 1: Foundation');
|
||||
expect(tasks[2].phase).toBe('Phase 2: Implementation');
|
||||
expect(tasks[3].phase).toBe('Phase 2: Implementation');
|
||||
expect(tasks[4].phase).toBe('Phase 3: Testing');
|
||||
});
|
||||
|
||||
it("should return empty array for content without tasks", () => {
|
||||
const specContent = "Just some text without any tasks";
|
||||
it('should return empty array for content without tasks', () => {
|
||||
const specContent = 'Just some text without any tasks';
|
||||
const tasks = parseTasksFromSpec(specContent);
|
||||
expect(tasks).toEqual([]);
|
||||
});
|
||||
|
||||
it("should fallback to finding task lines outside code block", () => {
|
||||
it('should fallback to finding task lines outside code block', () => {
|
||||
const specContent = `
|
||||
## Implementation Plan
|
||||
|
||||
@@ -201,11 +201,11 @@ Some notes here.
|
||||
`;
|
||||
const tasks = parseTasksFromSpec(specContent);
|
||||
expect(tasks).toHaveLength(2);
|
||||
expect(tasks[0].id).toBe("T001");
|
||||
expect(tasks[1].id).toBe("T002");
|
||||
expect(tasks[0].id).toBe('T001');
|
||||
expect(tasks[1].id).toBe('T002');
|
||||
});
|
||||
|
||||
it("should handle empty tasks block", () => {
|
||||
it('should handle empty tasks block', () => {
|
||||
const specContent = `
|
||||
\`\`\`tasks
|
||||
\`\`\`
|
||||
@@ -214,7 +214,7 @@ Some notes here.
|
||||
expect(tasks).toEqual([]);
|
||||
});
|
||||
|
||||
it("should handle mixed valid and invalid lines", () => {
|
||||
it('should handle mixed valid and invalid lines', () => {
|
||||
const specContent = `
|
||||
\`\`\`tasks
|
||||
- [ ] T001: Valid task | File: src/valid.ts
|
||||
@@ -227,7 +227,7 @@ Some other text
|
||||
expect(tasks).toHaveLength(2);
|
||||
});
|
||||
|
||||
it("should preserve task order", () => {
|
||||
it('should preserve task order', () => {
|
||||
const specContent = `
|
||||
\`\`\`tasks
|
||||
- [ ] T003: Third
|
||||
@@ -236,12 +236,12 @@ Some other text
|
||||
\`\`\`
|
||||
`;
|
||||
const tasks = parseTasksFromSpec(specContent);
|
||||
expect(tasks[0].id).toBe("T003");
|
||||
expect(tasks[1].id).toBe("T001");
|
||||
expect(tasks[2].id).toBe("T002");
|
||||
expect(tasks[0].id).toBe('T003');
|
||||
expect(tasks[1].id).toBe('T001');
|
||||
expect(tasks[2].id).toBe('T002');
|
||||
});
|
||||
|
||||
it("should handle task IDs with different numbers", () => {
|
||||
it('should handle task IDs with different numbers', () => {
|
||||
const specContent = `
|
||||
\`\`\`tasks
|
||||
- [ ] T001: First
|
||||
@@ -251,14 +251,14 @@ Some other text
|
||||
`;
|
||||
const tasks = parseTasksFromSpec(specContent);
|
||||
expect(tasks).toHaveLength(3);
|
||||
expect(tasks[0].id).toBe("T001");
|
||||
expect(tasks[1].id).toBe("T010");
|
||||
expect(tasks[2].id).toBe("T100");
|
||||
expect(tasks[0].id).toBe('T001');
|
||||
expect(tasks[1].id).toBe('T010');
|
||||
expect(tasks[2].id).toBe('T100');
|
||||
});
|
||||
});
|
||||
|
||||
describe("spec content generation patterns", () => {
|
||||
it("should match the expected lite mode output format", () => {
|
||||
describe('spec content generation patterns', () => {
|
||||
it('should match the expected lite mode output format', () => {
|
||||
const liteModeOutput = `
|
||||
1. **Goal**: Implement user registration
|
||||
2. **Approach**: Create form component, add validation, connect to API
|
||||
@@ -271,12 +271,12 @@ Some other text
|
||||
|
||||
[PLAN_GENERATED] Planning outline complete.
|
||||
`;
|
||||
expect(liteModeOutput).toContain("[PLAN_GENERATED]");
|
||||
expect(liteModeOutput).toContain("Goal");
|
||||
expect(liteModeOutput).toContain("Approach");
|
||||
expect(liteModeOutput).toContain('[PLAN_GENERATED]');
|
||||
expect(liteModeOutput).toContain('Goal');
|
||||
expect(liteModeOutput).toContain('Approach');
|
||||
});
|
||||
|
||||
it("should match the expected spec mode output format", () => {
|
||||
it('should match the expected spec mode output format', () => {
|
||||
const specModeOutput = `
|
||||
1. **Problem**: Users cannot register for accounts
|
||||
|
||||
@@ -300,12 +300,12 @@ Some other text
|
||||
|
||||
[SPEC_GENERATED] Please review the specification above.
|
||||
`;
|
||||
expect(specModeOutput).toContain("[SPEC_GENERATED]");
|
||||
expect(specModeOutput).toContain("```tasks");
|
||||
expect(specModeOutput).toContain("T001");
|
||||
expect(specModeOutput).toContain('[SPEC_GENERATED]');
|
||||
expect(specModeOutput).toContain('```tasks');
|
||||
expect(specModeOutput).toContain('T001');
|
||||
});
|
||||
|
||||
it("should match the expected full mode output format", () => {
|
||||
it('should match the expected full mode output format', () => {
|
||||
const fullModeOutput = `
|
||||
1. **Problem Statement**: Users need ability to create accounts
|
||||
|
||||
@@ -336,10 +336,10 @@ Some other text
|
||||
|
||||
[SPEC_GENERATED] Please review the comprehensive specification above.
|
||||
`;
|
||||
expect(fullModeOutput).toContain("Phase 1");
|
||||
expect(fullModeOutput).toContain("Phase 2");
|
||||
expect(fullModeOutput).toContain("Phase 3");
|
||||
expect(fullModeOutput).toContain("[SPEC_GENERATED]");
|
||||
expect(fullModeOutput).toContain('Phase 1');
|
||||
expect(fullModeOutput).toContain('Phase 2');
|
||||
expect(fullModeOutput).toContain('Phase 3');
|
||||
expect(fullModeOutput).toContain('[SPEC_GENERATED]');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user