The hover card was previously gated to open only when a PR hint or diff stat was available. It now opens on every desktop-web workspace hover so users can see the workspace name, branch, and working directory. The CWD is shortened using the existing shortenPath helper (/Users/... -> ~).
30 lines
935 B
TypeScript
30 lines
935 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { shortenPath } from "./shorten-path";
|
|
|
|
describe("shortenPath", () => {
|
|
it("shortens a macOS home directory path", () => {
|
|
expect(shortenPath("/Users/moboudra/dev/paseo")).toBe("~/dev/paseo");
|
|
});
|
|
|
|
it("shortens a Linux home directory path", () => {
|
|
expect(shortenPath("/home/moboudra/dev/paseo")).toBe("~/dev/paseo");
|
|
});
|
|
|
|
it("leaves non-home absolute paths unchanged", () => {
|
|
expect(shortenPath("/var/www/app")).toBe("/var/www/app");
|
|
});
|
|
|
|
it("leaves Windows paths unchanged", () => {
|
|
expect(shortenPath("C:\\Users\\moboudra\\dev\\paseo")).toBe("C:\\Users\\moboudra\\dev\\paseo");
|
|
});
|
|
|
|
it("returns an empty string for null or undefined", () => {
|
|
expect(shortenPath(null)).toBe("");
|
|
expect(shortenPath(undefined)).toBe("");
|
|
});
|
|
|
|
it("returns an empty string for an empty string", () => {
|
|
expect(shortenPath("")).toBe("");
|
|
});
|
|
});
|