mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-16 21:31:58 +01:00
The 188 unit tests move verbatim into claude-pty-runner.{screen,classify,
auq,launch,plan-native,boundaries}.unit.test.ts (test names unchanged; each
file imports only what it uses from the barrel). The five files that no longer
read a SKILL.md template join the test-of-test ratchet baseline with a reason.
79 lines
1.9 KiB
TypeScript
79 lines
1.9 KiB
TypeScript
/**
|
|
* Deterministic unit tests for native plan terminal/report checks (test/helpers/pty/plan-native.ts).
|
|
* Split along the W4 module seams from the former claude-pty-runner.unit.test.ts;
|
|
* tests import the public barrel, test/helpers/claude-pty-runner.ts.
|
|
*/
|
|
import { describe, test, expect } from 'bun:test';
|
|
import {
|
|
assertReviewReportAtBottom,
|
|
} from './claude-pty-runner';
|
|
|
|
describe('assertReviewReportAtBottom', () => {
|
|
test('passes when REVIEW REPORT is the only/last ## heading', () => {
|
|
const content = `# Plan
|
|
|
|
## Context
|
|
stuff
|
|
|
|
## Approach
|
|
more stuff
|
|
|
|
## GSTACK REVIEW REPORT
|
|
|
|
| col | col |
|
|
`;
|
|
const r = assertReviewReportAtBottom(content);
|
|
expect(r.ok).toBe(true);
|
|
});
|
|
|
|
test('fails when REVIEW REPORT is missing', () => {
|
|
const content = `# Plan
|
|
|
|
## Context
|
|
stuff
|
|
`;
|
|
const r = assertReviewReportAtBottom(content);
|
|
expect(r.ok).toBe(false);
|
|
expect(r.reason).toMatch(/no GSTACK REVIEW REPORT/);
|
|
});
|
|
|
|
test('fails when REVIEW REPORT exists but a ## heading follows it', () => {
|
|
const content = `# Plan
|
|
|
|
## GSTACK REVIEW REPORT
|
|
|
|
| col | col |
|
|
|
|
## Late Section
|
|
oops
|
|
`;
|
|
const r = assertReviewReportAtBottom(content);
|
|
expect(r.ok).toBe(false);
|
|
expect(r.reason).toMatch(/trailing ## heading/);
|
|
expect(r.trailingHeadings).toEqual(['## Late Section']);
|
|
});
|
|
|
|
test('passes when only ### subheadings follow REVIEW REPORT (deeper nesting allowed)', () => {
|
|
const content = `## GSTACK REVIEW REPORT
|
|
|
|
### Cross-model tension
|
|
- F1: resolved
|
|
- F2: resolved
|
|
`;
|
|
const r = assertReviewReportAtBottom(content);
|
|
expect(r.ok).toBe(true);
|
|
});
|
|
|
|
test('fails with multiple trailing ## headings reported', () => {
|
|
const content = `## GSTACK REVIEW REPORT
|
|
|
|
## First trailing
|
|
|
|
## Second trailing
|
|
`;
|
|
const r = assertReviewReportAtBottom(content);
|
|
expect(r.ok).toBe(false);
|
|
expect(r.trailingHeadings).toHaveLength(2);
|
|
});
|
|
});
|