honkit
Version:
HonKit is building beautiful books using Markdown.
34 lines (33 loc) • 1.45 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const promise_1 = __importDefault(require("../../utils/promise"));
const mock_1 = __importDefault(require("../../fs/mock"));
const book_1 = __importDefault(require("../../models/book"));
const parseReadme_1 = __importDefault(require("../parseReadme"));
describe("parseReadme", () => {
test("should parse summary if exists", () => {
const fs = (0, mock_1.default)({
"README.md": "# Hello\n\nAnd here is the description.",
});
const book = book_1.default.createForFS(fs);
return (0, parseReadme_1.default)(book).then((resultBook) => {
const readme = resultBook.getReadme();
const file = readme.getFile();
expect(file.exists()).toBeTruthy();
expect(readme.getTitle()).toBe("Hello");
expect(readme.getDescription()).toBe("And here is the description.");
});
});
test("should fail if doesn't exist", () => {
const fs = (0, mock_1.default)({});
const book = book_1.default.createForFS(fs);
return (0, parseReadme_1.default)(book).then((resultBook) => {
throw new Error("It should have fail");
}, () => {
return (0, promise_1.default)();
});
});
});