30 lines
940 B
TypeScript
30 lines
940 B
TypeScript
import { describe, expect, it } from "vite-plus/test";
|
|
|
|
import { serializeComposerFileLink } from "./composerTrigger.ts";
|
|
|
|
describe("serializeComposerFileLink", () => {
|
|
it("uses the basename as the markdown label", () => {
|
|
expect(serializeComposerFileLink("path/to/package.json")).toBe(
|
|
"[package.json](path/to/package.json)",
|
|
);
|
|
});
|
|
|
|
it("encodes markdown-sensitive destination characters", () => {
|
|
expect(serializeComposerFileLink("docs/My File (draft).md")).toBe(
|
|
"[My File (draft).md](docs/My%20File%20%28draft%29.md)",
|
|
);
|
|
});
|
|
|
|
it("supports windows paths", () => {
|
|
expect(serializeComposerFileLink("C:\\repo\\src\\index.ts")).toBe(
|
|
"[index.ts](C:%5Crepo%5Csrc%5Cindex.ts)",
|
|
);
|
|
});
|
|
|
|
it("preserves paths that legitimately start with an at sign", () => {
|
|
expect(serializeComposerFileLink("@scope/package.json")).toBe(
|
|
"[package.json](@scope/package.json)",
|
|
);
|
|
});
|
|
});
|