-
Notifications
You must be signed in to change notification settings - Fork 125
/
Copy pathcontent_renderer.spec.ts
34 lines (31 loc) · 1.06 KB
/
content_renderer.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { describe, it, expect } from "vitest";
import { renderCode, type Result } from "./content_renderer.js";
describe("content_renderer", () => {
describe("renderCode", () => {
it("identifies empty content", () => {
const emptyResult: Result = {
header: "",
content: " "
};
renderCode(emptyResult);
expect(emptyResult.isEmpty).toBeTruthy();
});
it("identifies unsupported content type", () => {
const emptyResult: Result = {
header: "",
content: Buffer.from("Hello world")
};
renderCode(emptyResult);
expect(emptyResult.isEmpty).toBeTruthy();
});
it("wraps code in <pre>", () => {
const result: Result = {
header: "",
content: "\tHello\nworld"
};
renderCode(result);
expect(result.isEmpty).toBeFalsy();
expect(result.content).toBe("<pre>\tHello\nworld</pre>");
});
});
});