Files
outline/shared/editor/lib/code.test.ts
Copilotandtommoor 5c01909909 Add Fortran language support to code blocks (#11471)
* Initial plan

* Add Fortran language support to code blocks

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

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
2026-02-16 10:49:24 -05:00

29 lines
1.4 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("fortran")).toBe("fortran");
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("fortran")).toBe("Fortran");
expect(getLabelForLanguage("unknown")).toBe("Plain text");
expect(getLabelForLanguage("none")).toBe("Plain text");
expect(getLabelForLanguage("")).toBe("Plain text");
});
});