Skip to content

Commit 2d4cfb4

Browse files
committed
test(showcase): reconcile default catch-all probe checks
1 parent 3c3b251 commit 2d4cfb4

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

‎showcase/harness/src/probes/scripts/d5-tool-rendering-default-catchall.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ describe("D5 tool-rendering-default-catchall — validateDefaultCatchall", () =>
141141
statusAttributePresent: true,
142142
observedToolNames: ["get_weather"],
143143
observedStatuses: ["complete"],
144+
customLeakPhrasePresent: false,
144145
});
145146
expect(err).toMatch(/no status pill/);
146147
});
@@ -166,6 +167,7 @@ describe("D5 tool-rendering-default-catchall — validateDefaultCatchall", () =>
166167
statusAttributePresent: false,
167168
observedToolNames: [],
168169
observedStatuses: [],
170+
customLeakPhrasePresent: false,
169171
});
170172
expect(err).toMatch(/\(none\)/);
171173
});
@@ -205,6 +207,7 @@ describe("D5 tool-rendering-default-catchall — probeDefaultCatchall", () => {
205207
statusAttributePresent: true,
206208
observedToolNames: ["get_weather"],
207209
observedStatuses: ["complete"],
210+
customLeakPhrasePresent: false,
208211
});
209212
});
210213

@@ -223,6 +226,7 @@ describe("D5 tool-rendering-default-catchall — probeDefaultCatchall", () => {
223226
statusAttributePresent: false,
224227
observedToolNames: [],
225228
observedStatuses: [],
229+
customLeakPhrasePresent: false,
226230
});
227231
});
228232
});
@@ -316,7 +320,9 @@ describe("D5 tool-rendering-default-catchall — customLeakPhrasePresent branch
316320
const err = mod.validateDefaultCatchall({
317321
containerWithToolName: true,
318322
statusPillPresent: true,
323+
statusAttributePresent: true,
319324
observedToolNames: ["get_weather"],
325+
observedStatuses: ["complete"],
320326
customLeakPhrasePresent: true,
321327
});
322328
expect(err).not.toBeNull();
@@ -331,7 +337,9 @@ describe("D5 tool-rendering-default-catchall — customLeakPhrasePresent branch
331337
mod.validateDefaultCatchall({
332338
containerWithToolName: true,
333339
statusPillPresent: true,
340+
statusAttributePresent: true,
334341
observedToolNames: ["get_weather"],
342+
observedStatuses: ["complete"],
335343
customLeakPhrasePresent: false,
336344
}),
337345
).toBeNull();
@@ -343,7 +351,9 @@ describe("D5 tool-rendering-default-catchall — customLeakPhrasePresent branch
343351
mod.validateDefaultCatchall({
344352
containerWithToolName: true,
345353
statusPillPresent: true,
354+
statusAttributePresent: true,
346355
observedToolNames: ["get_weather"],
356+
observedStatuses: ["complete"],
347357
// customLeakPhrasePresent omitted — treated as false.
348358
}),
349359
).toBeNull();

‎showcase/harness/src/probes/scripts/d5-tool-rendering-default-catchall.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export async function probeDefaultCatchall(
127127
textContent?: string | null;
128128
}>;
129129
querySelector(sel: string): unknown;
130-
body: { textContent?: string | null };
130+
body?: { textContent?: string | null };
131131
};
132132
};
133133

@@ -171,8 +171,7 @@ export async function probeDefaultCatchall(
171171
}
172172
}
173173
if (!customLeakPhrasePresent) {
174-
const body = win.document.body;
175-
const bodyText = (body.textContent ?? "") as string;
174+
const bodyText = (win.document.body?.textContent ?? "") as string;
176175
customLeakPhrasePresent = bodyText.includes(needle);
177176
}
178177

0 commit comments

Comments
 (0)