Files
outline/shared/editor/lib/code.test.ts
7b6293637c Add diff language highlighting for code blocks (#11301)
* Initial plan

* Add diff language highlighting support

Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>

* Styling

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2026-01-29 08:44:18 -05:00

27 lines
1.3 KiB
TypeScript

import { getRefractorLangForLanguage, getLabelForLanguage } from "./code";
describe("getRefractorLangForLanguage", () => {
it("should return the correct lang identifier for a given language", () => {
expect(getRefractorLangForLanguage("javascript")).toBe("javascript");
expect(getRefractorLangForLanguage("mermaid")).toBe("mermaid");
expect(getRefractorLangForLanguage("mermaidjs")).toBe("mermaid");
expect(getRefractorLangForLanguage("xml")).toBe("markup");
expect(getRefractorLangForLanguage("diff")).toBe("diff");
expect(getRefractorLangForLanguage("unknown")).toBeUndefined();
expect(getRefractorLangForLanguage("")).toBeUndefined();
});
});
describe("getLabelForLanguage", () => {
it("should return the correct human-readable label for a given language", () => {
expect(getLabelForLanguage("javascript")).toBe("JavaScript");
expect(getLabelForLanguage("mermaid")).toBe("Mermaid");
expect(getLabelForLanguage("mermaidjs")).toBe("Mermaid");
expect(getLabelForLanguage("xml")).toBe("XML");
expect(getLabelForLanguage("diff")).toBe("Diff");
expect(getLabelForLanguage("unknown")).toBe("Plain text");
expect(getLabelForLanguage("none")).toBe("Plain text");
expect(getLabelForLanguage("")).toBe("Plain text");
});
});