|
1 | 1 | import type { ActionsBlockAction } from "@internal/dashboard-agent-contracts"; |
2 | 2 | import { readFileSync } from "node:fs"; |
3 | 3 | import { describe, expect, it } from "vitest"; |
4 | | -import { renderableActions } from "./view-actions"; |
| 4 | +import { answerContinuesAfter, renderableActions } from "./view-actions"; |
5 | 5 |
|
6 | 6 | const askAction: ActionsBlockAction = { |
7 | 7 | label: "Investigate it", |
@@ -32,6 +32,21 @@ describe("renderableActions", () => { |
32 | 32 | }); |
33 | 33 | }); |
34 | 34 |
|
| 35 | +describe("keep digging, only while there is digging left", () => { |
| 36 | + const card = { type: "data-view" }; |
| 37 | + const text = (t: string) => ({ type: "text", text: t }); |
| 38 | + |
| 39 | + it("sees the answer the turn went on to give", () => { |
| 40 | + expect(answerContinuesAfter([card, text("so here is why")] as never, 0)).toBe(true); |
| 41 | + }); |
| 42 | + |
| 43 | + it("leaves a card the turn ended on", () => { |
| 44 | + expect(answerContinuesAfter([text("looking"), card] as never, 1)).toBe(false); |
| 45 | + // An empty trailing text part is not an answer. |
| 46 | + expect(answerContinuesAfter([card, text(" ")] as never, 0)).toBe(false); |
| 47 | + }); |
| 48 | +}); |
| 49 | + |
35 | 50 | describe("ActionsBlock", () => { |
36 | 51 | const source = readFileSync(new URL("./ActionsBlock.tsx", import.meta.url), "utf8"); |
37 | 52 |
|
|
0 commit comments