UNPKG

honkit

Version:

HonKit is building beautiful books using Markdown.

28 lines (27 loc) 1.21 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const immutable_1 = __importDefault(require("immutable")); const templateBlock_1 = __importDefault(require("../../models/templateBlock")); const replaceShortcuts_1 = __importDefault(require("../replaceShortcuts")); describe("replaceShortcuts", () => { const blocks = immutable_1.default.List([ templateBlock_1.default.create("math", { shortcuts: { start: "$$", end: "$$", parsers: ["markdown"], }, }), ]); test("should correctly replace inline matches by block", () => { const content = (0, replaceShortcuts_1.default)(blocks, "test.md", "Hello $$a = b$$"); expect(content).toBe("Hello {% math %}a = b{% endmath %}"); }); test("should correctly replace block matches", () => { const content = (0, replaceShortcuts_1.default)(blocks, "test.md", "Hello\n$$\na = b\n$$\n"); expect(content).toBe("Hello\n{% math %}\na = b\n{% endmath %}\n"); }); });