Q52: goal closures stop linked work, and running sessions hear goal changes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d9cb86a999
commit
69e991ff93
5 files changed
+134
-1
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { DatabaseSync } from "node:sqlite";
|
||||
import { describe, expect, test } from "vitest";
|
||||
import { combineMidRunPolls, createGoalChangePoller } from "../../src/main/services/goal-change-poller";
|
||||
|
||||
describe("goal change poller", () => {
|
||||
test("reports a closure and a rewrite once each, against the state seen when the run began", () => {
|
||||
const db = new DatabaseSync(":memory:");
|
||||
db.exec("create table goals(id text primary key, title text, description text, status text); insert into goals values ('g1', 'Ship', 'MVP', 'active');");
|
||||
const poll = createGoalChangePoller(db, "g1");
|
||||
expect(poll()).toBeNull();
|
||||
db.exec("update goals set status = 'achieved' where id = 'g1'");
|
||||
expect(poll()).toBe('The goal for this work ("Ship") is now achieved. Stop starting new work on it: wrap up, report what you finished, and set this task\'s status.');
|
||||
expect(poll()).toBeNull();
|
||||
db.exec("update goals set description = 'Paid beta' where id = 'g1'");
|
||||
expect(poll()).toContain("It now reads: \"Ship\" — Paid beta");
|
||||
expect(createGoalChangePoller(db, null)()).toBeNull();
|
||||
expect(combineMidRunPolls(() => "a", () => null, () => "b")()).toBe("a\n\nb");
|
||||
db.close();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user