Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

composerTrigger.test.ts

29 lines940 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { serializeComposerFileLink } from "./composerTrigger.ts";
4​
5describe("serializeComposerFileLink", () => {
6 it("uses the basename as the markdown label", () => {
7 expect(serializeComposerFileLink("path/to/package.json")).toBe(
8 "[package.json](path/to/package.json)",
9 );
10 });
11​
12 it("encodes markdown-sensitive destination characters", () => {
13 expect(serializeComposerFileLink("docs/My File (draft).md")).toBe(
14 "[My File (draft).md](docs/My%20File%20%28draft%29.md)",
15 );
16 });
17​
18 it("supports windows paths", () => {
19 expect(serializeComposerFileLink("C:\\repo\\src\\index.ts")).toBe(
20 "[index.ts](C:%5Crepo%5Csrc%5Cindex.ts)",
21 );
22 });
23​
24 it("preserves paths that legitimately start with an at sign", () => {
25 expect(serializeComposerFileLink("@scope/package.json")).toBe(
26 "[package.json](@scope/package.json)",
27 );
28 });
29});