Download src/agents/worktrees/name.test.ts from SaylorTwift/openclaw: direct link, hf CLI and curl.
- Browser
- Download file 905 Bytes
-
https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/agents/worktrees/name.test.ts
- Command line
-
hf download hf://SaylorTwift/openclaw/src/agents/worktrees/name.test.ts
-
curl -L -o name.test.ts https://huggingface.co/SaylorTwift/openclaw/resolve/main/src/agents/worktrees/name.test.ts
905 Bytes
| import { describe, expect, it } from "vitest"; | |
| import { slugifyWorktreeTitle } from "./name.js"; | |
| describe("slugifyWorktreeTitle", () => { | |
| it.each([ | |
| ["Fix agent selection menu", "fix-agent-selection-menu"], | |
| ["Crème brûlée & release prep", "creme-brulee-and-release-prep"], | |
| [' Title: "Worktree names" ', "title-worktree-names"], | |
| ])("slugifies %s", (title, expected) => { | |
| expect(slugifyWorktreeTitle(title)).toBe(expected); | |
| }); | |
| it("truncates at the last complete word within the worktree contract limit", () => { | |
| expect(slugifyWorktreeTitle(`${"a".repeat(50)} complete unfinished`)).toBe( | |
| `${"a".repeat(50)}-complete`, | |
| ); | |
| expect(slugifyWorktreeTitle(`${"a".repeat(63)} two`)).toBe("a".repeat(63)); | |
| }); | |
| it("returns undefined when a title has no ASCII slug characters", () => { | |
| expect(slugifyWorktreeTitle("🦞 日本語")).toBeUndefined(); | |
| }); | |
| }); | |