test(gsd): align widget assertions after tui conflict resolution

This commit is contained in:
Jeremy 2026-04-12 09:14:41 -05:00
parent cd86e8a7d0
commit 4d41b21fbd
2 changed files with 3 additions and 39 deletions

View file

@ -1,37 +0,0 @@
/**
* auto-start-discuss-loop-breaker.test.ts Regression tests for stuck discuss state.
*
* When bootstrap auto-mode repeatedly re-enters with no active milestone and the
* discuss flow doesn't create one, the loop-breaker warning should also clear the
* pending discuss guard so `/gsd` is not stuck on "Discussion already in progress".
*/
import { test } from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
import { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const source = readFileSync(join(__dirname, "..", "auto-start.ts"), "utf-8");
test("complete-bootstrap loop-breaker clears pending discuss state (#stuck-discussion)", () => {
const guard = "if (s.consecutiveCompleteBootstraps > MAX_CONSECUTIVE_COMPLETE_BOOTSTRAPS)";
const guardIdx = source.indexOf(guard);
assert.ok(guardIdx >= 0, "expected complete-bootstrap loop-breaker guard");
const clearIdx = source.indexOf("clearPendingAutoStart(base)", guardIdx);
assert.ok(clearIdx > guardIdx, "loop-breaker should clear pending discuss state for this project");
const notifyIdx = source.indexOf(
"All milestones are complete and the discussion didn't produce a new one.",
guardIdx,
);
assert.ok(notifyIdx > guardIdx, "loop-breaker should emit warning message");
assert.ok(clearIdx < notifyIdx, "pending discuss state should be cleared before warning/return");
});
test("loop-breaker uses guided-flow clearPendingAutoStart import", () => {
const importIdx = source.indexOf('await import("./guided-flow.js")');
assert.ok(importIdx >= 0, "expected guided-flow dynamic import for cleanup helper");
});

View file

@ -7,7 +7,7 @@ import { tmpdir } from "node:os";
import { initNotificationStore, appendNotification, _resetNotificationStore } from "../notification-store.js";
import { buildNotificationWidgetLines } from "../notification-widget.js";
test("buildNotificationWidgetLines includes slash-command fallback for unread notifications", () => {
test("buildNotificationWidgetLines shows unread count with shortcut pair", () => {
const tmp = mkdtempSync(join(tmpdir(), "gsd-notification-widget-"));
try {
mkdirSync(join(tmp, ".gsd"), { recursive: true });
@ -17,7 +17,8 @@ test("buildNotificationWidgetLines includes slash-command fallback for unread no
const lines = buildNotificationWidgetLines();
assert.equal(lines.length, 1);
assert.match(lines[0]!, /\/gsd notifications/);
assert.match(lines[0]!, /Notifications:\s+1 unread/);
assert.match(lines[0]!, /\(.+\/.+\)/);
} finally {
_resetNotificationStore();
rmSync(tmp, { recursive: true, force: true });