UNPKG

honkit

Version:

HonKit is building beautiful books using Markdown.

33 lines (32 loc) 1.4 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const book_1 = __importDefault(require("../../models/book")); const mock_1 = __importDefault(require("../../fs/mock")); const parseGlossary_1 = __importDefault(require("../parseGlossary")); describe("parseGlossary", () => { test("should parse glossary if exists", () => { const fs = (0, mock_1.default)({ "GLOSSARY.md": "# Glossary\n\n## Hello\nDescription for hello", }); const book = book_1.default.createForFS(fs); return (0, parseGlossary_1.default)(book).then((resultBook) => { const glossary = resultBook.getGlossary(); const file = glossary.getFile(); const entries = glossary.getEntries(); expect(file.exists()).toBeTruthy(); expect(entries.size).toBe(1); }); }); test("should not fail if doesn't exist", () => { const fs = (0, mock_1.default)({}); const book = book_1.default.createForFS(fs); return (0, parseGlossary_1.default)(book).then((resultBook) => { const glossary = resultBook.getGlossary(); const file = glossary.getFile(); expect(file.exists()).toBeFalsy(); }); }); });