profileShare

rasmusjy / voicetask

Read-only snapshot

No repository description.

main default branch 105 files Expires Sep 13, 2026, 9:06 AM
parse.test.ts 1,989 bytes
1 import { describe, expect, it } from 'vitest'
2 import { parseBlockedFile } from './parse'
3
4 const TEMPLATE_EMPTY = `# BLOCKED
5
6 Entries the coding agent could not resolve without a product decision. The agent appends entries; the human answers by editing the entry and adding an \`ANSWER:\` line, then relaunches per spec/HANDOFF.md.
7
8 Entry format:
9
10 \`\`\`
11 ## B<n>: <one-line summary>
12 - Task: T<n>
13 - Question: <what decision is needed and why the spec does not answer it>
14 - Options considered: <a>, <b>
15 - Continued with: <what the agent did instead, or "skipped task">
16 \`\`\`
17
18 No entries yet.
19 `
20
21 const TEMPLATE_WITH_ENTRIES = `# BLOCKED
22
23 Entries the coding agent could not resolve without a product decision.
24
25 ## B1: which auth provider to use
26 - Task: T4
27 - Question: Should sign-in use email/password or an OAuth provider?
28 - Options considered: email/password, Google OAuth
29 - Continued with: implemented email/password, left OAuth for later
30
31 ## B2: rate limit thresholds
32 - Task: T6
33 - Question: What is the max requests per minute per user?
34 - Options considered: 60, 120
35 - Continued with: skipped task
36 `
37
38 describe('parseBlockedFile', () => {
39 it('returns no entries for the template placeholder text', () => {
40 expect(parseBlockedFile(TEMPLATE_EMPTY)).toEqual([])
41 })
42
43 it('returns no entries for an empty string', () => {
44 expect(parseBlockedFile('')).toEqual([])
45 })
46
47 it('parses each blocker entry into its fields', () => {
48 const entries = parseBlockedFile(TEMPLATE_WITH_ENTRIES)
49 expect(entries).toHaveLength(2)
50 expect(entries[0]).toEqual({
51 id: 'B1',
52 summary: 'which auth provider to use',
53 task: 'T4',
54 question: 'Should sign-in use email/password or an OAuth provider?',
55 optionsConsidered: 'email/password, Google OAuth',
56 continuedWith: 'implemented email/password, left OAuth for later',
57 })
58 expect(entries[1]).toMatchObject({
59 id: 'B2',
60 question: 'What is the max requests per minute per user?',
61 })
62 })
63 })
64