Skip to content

test: add unit tests for plan-parser module#20

Open
Alexi5000 wants to merge 1 commit into
OpenKnots:mainfrom
Alexi5000:pr/test-plan-parser
Open

test: add unit tests for plan-parser module#20
Alexi5000 wants to merge 1 commit into
OpenKnots:mainfrom
Alexi5000:pr/test-plan-parser

Conversation

@Alexi5000
Copy link
Copy Markdown

Summary

Adds comprehensive unit tests for lib/plan-parser.ts — the only lib module with zero test coverage.

Why

parsePlanSteps and isPlanContent are load-bearing: they decide whether the agent panel switches to planner view and how plan-view populates its step list. Every other logic-containing lib/ module has a test file, making this an obvious gap.

Test Coverage

Function Cases
parsePlanSteps 10 test cases covering plain prose, numbered lists, bold titles, em-dash splitting, file extraction, deduplication, step IDs, pending status, trailing colons, description continuation
isPlanContent 4 test cases covering threshold behavior (< 3 steps = false, >= 3 = true)

Test Plan

  • pnpm test __tests__/plan-parser.test.ts — all pass
  • Existing tests unaffected (pnpm test)

Covers parsePlanSteps and isPlanContent with tests for:
- Plain prose (returns empty)
- Simple numbered lists
- Bold title extraction
- Em-dash title/description splitting
- Backtick file path extraction and deduplication
- Sequential step ID assignment
- Pending status initialization
- Trailing colon removal
- Indented description continuation
- Non-file-path filtering (npm/pnpm commands)
- isPlanContent threshold (3+ steps)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant