File size: 644 Bytes
eb3f11e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Syntax highlight tests cover the lazy highlight.js integration and theme
// callback rendering used by interactive output.
import { describe, expect, it } from "vitest";
import { highlight, supportsLanguage } from "./syntax-highlight.js";

describe("syntax highlighting", () => {
  it("loads highlight.js through the package export and renders themed output", () => {
    expect(supportsLanguage("javascript")).toBe(true);

    const highlighted = highlight("const answer = 42;", {
      language: "javascript",
      theme: {
        keyword: (text) => `[${text}]`,
      },
    });

    expect(highlighted).toContain("[const]");
  });
});