forked from lessweb/deepcode-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwelcomeScreen.test.ts
More file actions
27 lines (22 loc) · 1.14 KB
/
welcomeScreen.test.ts
File metadata and controls
27 lines (22 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { test } from "node:test";
import assert from "node:assert/strict";
import { buildWelcomeTips, formatHomeRelativePath } from "../ui";
test("formatHomeRelativePath returns tilde for the home directory", () => {
assert.equal(formatHomeRelativePath("/Users/example", "/Users/example"), "~");
});
test("formatHomeRelativePath shortens paths inside the home directory", () => {
assert.equal(formatHomeRelativePath("/Users/example/dev/project", "/Users/example"), "~/dev/project");
});
test("formatHomeRelativePath keeps paths outside the home directory absolute", () => {
assert.equal(formatHomeRelativePath("/tmp/project", "/Users/example"), "/tmp/project");
});
test("buildWelcomeTips includes built-in slash commands and loaded skills", () => {
const tips = buildWelcomeTips([
{ name: "loaded", path: "/skills/loaded/SKILL.md", description: "Loaded skill", isLoaded: true },
{ name: "fresh", path: "/skills/fresh/SKILL.md", description: "Fresh skill" },
]);
const labels = tips.map((tip) => tip.label);
assert.ok(labels.includes("/new"));
assert.ok(labels.includes("/loaded"));
assert.equal(labels.includes("/fresh"), false);
});