(
text: string,
options?: {
readonly cwdSegment?: string
readonly label?: string
readonly normalize?: (text: string) => string
},
)
| 46 | } |
| 47 | |
| 48 | export function expectPromptFooterModules( |
| 49 | text: string, |
| 50 | options?: { |
| 51 | readonly cwdSegment?: string |
| 52 | readonly label?: string |
| 53 | readonly normalize?: (text: string) => string |
| 54 | }, |
| 55 | ): void { |
| 56 | const normalize = options?.normalize ?? normalizeReplText |
| 57 | const normalized = normalize(text) |
| 58 | const label = options?.label ?? 'prompt footer' |
| 59 | |
| 60 | expect( |
| 61 | / · (?:low|medium|high|max)\b/.test(normalized), |
| 62 | `${label} is missing model effort`, |
| 63 | ).toBe(true) |
| 64 | expect(normalized, `${label} should not show fast-mode placeholders`).not.toMatch( |
| 65 | /Fast (?:on|off)/, |
| 66 | ) |
| 67 | expect(normalized, `${label} should not show the main-thread placeholder`).not.toContain( |
| 68 | '· Main', |
| 69 | ) |
| 70 | expect(normalized, `${label} should not show the default permission placeholder`).not.toContain( |
| 71 | '[default]', |
| 72 | ) |
| 73 | |
| 74 | if (options?.cwdSegment) { |
| 75 | expect(normalized, `${label} is missing cwd segment`).toContain( |
| 76 | options.cwdSegment, |
| 77 | ) |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | export function assertInteractionContract<T>( |
| 82 | label: string, |
no test coverage detected