Always show workspace hover card with branch and directory

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/... -> ~).
This commit is contained in:
Mohamed Boudra
2026-06-16 15:27:02 +07:00
parent f5d39446cc
commit e77c8e2bf3
2 changed files with 56 additions and 24 deletions
@@ -0,0 +1,29 @@
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("");
});
});