refactor(app): extract project icon placeholder label logic
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
projectDisplayNameFromProjectId,
|
||||
projectIconPlaceholderLabelFromDisplayName,
|
||||
} from "./project-display-name";
|
||||
|
||||
describe("projectDisplayNameFromProjectId", () => {
|
||||
it("shows owner and repo for GitHub remote ids", () => {
|
||||
expect(projectDisplayNameFromProjectId("remote:github.com/getpaseo/paseo")).toBe(
|
||||
"getpaseo/paseo"
|
||||
);
|
||||
});
|
||||
|
||||
it("shows the trailing directory name for local projects", () => {
|
||||
expect(projectDisplayNameFromProjectId("/Users/me/dev/paseo")).toBe("paseo");
|
||||
});
|
||||
});
|
||||
|
||||
describe("projectIconPlaceholderLabelFromDisplayName", () => {
|
||||
it("uses repo name instead of owner for GitHub-style display names", () => {
|
||||
expect(projectIconPlaceholderLabelFromDisplayName("getpaseo/paseo")).toBe("paseo");
|
||||
});
|
||||
|
||||
it("returns the original display name when it has no path separator", () => {
|
||||
expect(projectIconPlaceholderLabelFromDisplayName("paseo")).toBe("paseo");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user