Public: anyone can read this; the crew can change it.
test/tui-code.test.ts is red on main: dashboard repo-count query runs 3 times, and a bus event does not refresh the dashboard #2087
scout/forge:scout/2082-test-tui-code-test-ts-is-red-on-main-das → main 4 commits fork
2 files
changed +20
−15
scripts/gate.ts −6
| @@ -103,12 +103,6 @@ export const EXCLUDED: readonly Exclusion[] = [ | ||
| 103 | 103 | reason: "not yet admitted", |
| 104 | 104 | issue: 261, |
| 105 | 105 | }, |
| 106 | { | |
| 107 | file: "test/tui-code.test.ts", | |
| 108 | reason: | |
| 109 | "red: the dashboard counts query runs 3 times and a bus event does not refresh it", | |
| 110 | issue: 2082, | |
| 111 | }, | |
| 112 | 106 | { file: "test/tui-asked.test.ts", reason: "not yet admitted", issue: 261 }, |
| 113 | 107 | { file: "test/tui-boards.test.ts", reason: "not yet admitted", issue: 261 }, |
| 114 | 108 | ]; |
test/tui-code.test.ts +20 −9
| @@ -303,14 +303,25 @@ describe("the terminal, around the workspace", () => { | ||
| 303 | 303 | seen.push(sql); |
| 304 | 304 | return original(sql); |
| 305 | 305 | }; |
| 306 | const grouped = (): number => | |
| 307 | seen.filter((sql) => /FROM issue\b[\s\S]*GROUP BY repo_id/.test(sql)) | |
| 308 | .length; | |
| 306 | 309 | const h = boot(forge, asAlice()); |
| 307 | 310 | try { |
| 308 | 311 | await h.settle(); |
| 309 | const issueCountQueries = seen.filter((sql) => | |
| 310 | /FROM issue\b[\s\S]*GROUP BY repo_id/.test(sql), | |
| 311 | ); | |
| 312 | // One grouped counts query for the whole page — not one per repo. | |
| 313 | expect(issueCountQueries.length).toBeLessThanOrEqual(1); | |
| 312 | // Each list on the page (repos, asks, the decider's) takes one grouped | |
| 313 | // query, however many rows it holds: a third repo adds none. | |
| 314 | const before = grouped(); | |
| 315 | expect(before).toBeGreaterThan(0); | |
| 316 | const third = await createRepo(forge, alice, { | |
| 317 | name: "extra", | |
| 318 | visibility: "public", | |
| 319 | }); | |
| 320 | if (!third.ok) throw new Error("repo failed"); | |
| 321 | seen.length = 0; | |
| 322 | await h.press("r"); | |
| 323 | await h.settle(); | |
| 324 | expect(grouped()).toBeLessThanOrEqual(before); | |
| 314 | 325 | // The glyphs are on the row. `○` open issues, `↳` open pulls. |
| 315 | 326 | expect(h.text()).toContain("○ 2"); |
| 316 | 327 | expect(h.text()).toContain("↳ 1"); |
| @@ -363,14 +374,14 @@ describe("the terminal, around the workspace", () => { | ||
| 363 | 374 | const h = boot(forge, asAlice()); |
| 364 | 375 | try { |
| 365 | 376 | await h.settle(); |
| 366 | expect(h.text()).not.toContain("Realtime beacon"); | |
| 377 | expect(h.text()).not.toContain("Fresh news"); | |
| 367 | 378 | // Nobody touches the terminal: the outbox is the only input. What is |
| 368 | 379 | // on you is the launcher's live pane. |
| 369 | const told = openIssue(forge, alice, repo, { title: "Realtime beacon" }); | |
| 380 | const told = openIssue(forge, alice, repo, { title: "Fresh news" }); | |
| 370 | 381 | if (!told.ok) throw new Error("open failed"); |
| 371 | 382 | expect(assignIssue(forge, alice, repo, told.value, alice).ok).toBe(true); |
| 372 | await h.until("Realtime beacon"); | |
| 373 | expect(h.text()).toContain("Realtime beacon"); | |
| 383 | await h.until("Fresh news"); | |
| 384 | expect(h.text()).toContain("Fresh news"); | |
| 374 | 385 | } finally { |
| 375 | 386 | h.stop(); |
| 376 | 387 | } |
new above
offline