mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
test(coach): follow the comparison read and the question pointer in the dialog scenarios
This commit is contained in:
1 parent
b1629e2ad3
commit
14bc609712
2 files changed
+14
-7
No files matched your search
@@ -314,7 +314,7 @@ describe("a model chip", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("continues a forced reply with the question it left unfinished", async () => {
|
||||
it("continues a forced reply, pointing at the question it left unfinished", async () => {
|
||||
conversationWithChips();
|
||||
world.storedFollowUps = [{ ...chip("f1", "continue"), anchor: undefined }];
|
||||
world.storedProvenance = {
|
||||
@@ -340,8 +340,11 @@ describe("a model chip", () => {
|
||||
await tap("f1");
|
||||
const system = providerCalls[0].system;
|
||||
expect(system).toContain(
|
||||
'CONTINUE: the person asked you to keep looking. Unfinished answer for: "How was my blood pressure last month?"',
|
||||
"CONTINUE: the person asked you to keep looking. The unfinished question is their message before that request, in CONVERSATION.",
|
||||
);
|
||||
// The question stays the person's own turn; it never reaches the
|
||||
// system role.
|
||||
expect(system).not.toContain("How was my blood pressure last month?");
|
||||
expect(system).toContain(
|
||||
"Already fetched: get_metric_table(bp, last30days, week) → m1.r1",
|
||||
);
|
||||
|
||||
@@ -465,11 +465,15 @@ describe.each(["de", "en"] as const)("in %s", (lang) => {
|
||||
([args]) => args as { from: Date; to: Date },
|
||||
);
|
||||
expect(reads.length).toBeGreaterThan(0);
|
||||
// The range ends about a year before now, not now.
|
||||
for (const read of reads) {
|
||||
const daysBack = (h.NOW.getTime() - read.to.getTime()) / 86_400_000;
|
||||
expect(daysBack).toBeGreaterThan(360);
|
||||
expect(daysBack).toBeLessThan(370);
|
||||
// The table's range ends about a year before now. The only other read
|
||||
// is the current window, which the summary compares it with.
|
||||
const daysBack = reads.map(
|
||||
(read) => (h.NOW.getTime() - read.to.getTime()) / 86_400_000,
|
||||
);
|
||||
const yearAgo = daysBack.filter((d) => d > 360 && d < 370);
|
||||
expect(yearAgo.length).toBeGreaterThan(0);
|
||||
for (const d of daysBack) {
|
||||
if (!(d > 360 && d < 370)) expect(d).toBeLessThan(1);
|
||||
}
|
||||
|
||||
const broken = await run(scenario, {
|
||||
|
||||
Reference in new issue
Block a user