Files
pi-plan/test/tick-goal.test.ts
T
wassname 88bfcc1c42 Fix symmetric supervision reconnect and cancel stale Ready attempts
Use explicit hello requests and replies, keep workers unready until model restoration succeeds, distinguish paused peers, and align all goal readers at the Log boundary. Add two-real-adapter handshake and failed-Ready/clear-during-wait regressions; warn once for unavailable supervisor context usage.
2026-09-08 19:27:09 +08:00

40 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { tickGoal } from "../src/index.js";
const plan = `# Plan
## Goals
1. [/] goal: Implement the cache layer
- tasks:
1. [x] wire client
2. [ ] goal: Ship the docs
## Log
`;
describe("tickGoal (sign-off ticks the goal; agent only ticks on wording drift)", () => {
it("ticks the exact-matching goal line, case-insensitive, leaving subtasks alone", () => {
const out = tickGoal(plan, "implement the CACHE layer");
expect(out).toContain("1. [x] goal: Implement the cache layer");
expect(out).toContain("1. [x] wire client"); // subtask untouched (was already x)
expect(out).toContain("2. [ ] goal: Ship the docs"); // other goal untouched
});
it("returns null on wording drift (fuzzy matching is the judge's job, not TypeScript's)", () => {
expect(tickGoal(plan, "Implement caching")).toBeNull();
});
it("returns null when the subject matches more than one goal line", () => {
const dup = plan.replace("## Log", "3. [ ] goal: Ship the docs\n\n## Log");
expect(tickGoal(dup, "Ship the docs")).toBeNull();
});
it("ignores a historical duplicate below the Log and leaves it unchanged", () => {
const historical = `${plan}3. [ ] goal: Ship the docs\n`;
const result = tickGoal(historical, "Ship the docs");
expect(result).toContain("2. [x] goal: Ship the docs");
expect(result).toContain("## Log\n3. [ ] goal: Ship the docs\n");
});
});