mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 06:57:26 +00:00
test: dedupe diffs file artifact assertions
This commit is contained in:
@@ -135,9 +135,7 @@ describe("diffs tool", () => {
|
|||||||
mode: "file",
|
mode: "file",
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(screenshotter.screenshotHtml).toHaveBeenCalledTimes(1);
|
expectArtifactOnlyFileResult(screenshotter, result);
|
||||||
expect((result?.details as Record<string, unknown>).mode).toBe("file");
|
|
||||||
expect((result?.details as Record<string, unknown>).viewerUrl).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("honors ttlSeconds for artifact-only file output", async () => {
|
it("honors ttlSeconds for artifact-only file output", async () => {
|
||||||
@@ -227,9 +225,7 @@ describe("diffs tool", () => {
|
|||||||
after: "two\n",
|
after: "two\n",
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(screenshotter.screenshotHtml).toHaveBeenCalledTimes(1);
|
expectArtifactOnlyFileResult(screenshotter, result);
|
||||||
expect((result?.details as Record<string, unknown>).mode).toBe("file");
|
|
||||||
expect((result?.details as Record<string, unknown>).viewerUrl).toBeUndefined();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("falls back to view output when both mode cannot render an image", async () => {
|
it("falls back to view output when both mode cannot render an image", async () => {
|
||||||
@@ -434,6 +430,15 @@ function createToolWithScreenshotter(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function expectArtifactOnlyFileResult(
|
||||||
|
screenshotter: DiffScreenshotter,
|
||||||
|
result: { details?: Record<string, unknown> } | null | undefined,
|
||||||
|
) {
|
||||||
|
expect(screenshotter.screenshotHtml).toHaveBeenCalledTimes(1);
|
||||||
|
expect((result?.details as Record<string, unknown>).mode).toBe("file");
|
||||||
|
expect((result?.details as Record<string, unknown>).viewerUrl).toBeUndefined();
|
||||||
|
}
|
||||||
|
|
||||||
function createPngScreenshotter(
|
function createPngScreenshotter(
|
||||||
params: {
|
params: {
|
||||||
assertHtml?: (html: string) => void;
|
assertHtml?: (html: string) => void;
|
||||||
|
|||||||
Reference in New Issue
Block a user