fix(browser): show saved screenshot path
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { describe, expect, it } from "bun:test";
|
||||
import { dedupeParseErrors, formatParseErrors } from "@oh-my-pi/pi-coding-agent/tools/render-utils";
|
||||
import * as os from "node:os";
|
||||
import * as path from "node:path";
|
||||
import { dedupeParseErrors, formatParseErrors, formatSavedScreenshotLine } from "@oh-my-pi/pi-coding-agent/tools/render-utils";
|
||||
|
||||
describe("parse error formatting", () => {
|
||||
it("deduplicates parse errors while preserving order", () => {
|
||||
@@ -30,3 +32,19 @@ describe("parse error formatting", () => {
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("browser screenshot path formatting", () => {
|
||||
it("shows home-relative saved paths with tilde shorthand", () => {
|
||||
const filePath = path.join(os.homedir(), "screenshots", "capture.png");
|
||||
|
||||
expect(formatSavedScreenshotLine("image/png", 2048, filePath)).toBe(
|
||||
"Saved: image/png (2.00 KB) to ~/screenshots/capture.png",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps non-home saved paths unchanged", () => {
|
||||
expect(formatSavedScreenshotLine("image/png", 2048, "/tmp/capture.png")).toBe(
|
||||
"Saved: image/png (2.00 KB) to /tmp/capture.png",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user