UNPKG

dokkie

Version:

Create good looking documentation from your Readme

79 lines 3.57 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const get_files_1 = require("./get-files"); const mock_1 = require("../test/mock"); const path_1 = require("path"); const mockOutput = "temp/files"; const altSettings = Object.assign(Object.assign({}, mock_1.baseSettings), { output: mockOutput, navigation: [], files: [ { name: "readme", path: "/Users/silvandiepen/Repos/_projects/dokkie/pages/usage/readme.md", ext: ".md", date: "2020-05-28T09:58:59.948Z", data: "# Test1\n", meta: {}, html: '<h1 id="test1">Test1</h1>\n', title: "Test1", route: path_1.join(mockOutput, "test1/index.html"), destpath: path_1.join(__dirname, "../../", mockOutput, "test1"), filename: "index.html", }, { name: "_2:partial", path: "/Users/silvandiepen/Repos/_projects/dokkie/pages/usage/_2:partial.md", ext: ".md", date: "2020-05-28T09:58:59.948Z", data: "# Partial\n", meta: { remove: true }, html: '<h2 id="partial">Partial</h2>\n', title: "First Partial", route: path_1.join(mockOutput, "test1/_partial.html"), destpath: path_1.join(__dirname, "../../", mockOutput, "_partial"), filename: "index.html", }, { name: "_1:another", path: "/Users/silvandiepen/Repos/_projects/dokkie/pages/usage/_1:another.md", ext: ".md", date: "2020-05-28T09:58:59.948Z", data: "# Another\n", meta: { remove: true }, html: '<h2 id="another">Another</h2>\n', title: "Another Partial", route: path_1.join(mockOutput, "test1/_another.html"), destpath: path_1.join(__dirname, "../../", mockOutput, "_another"), filename: "index.html", }, ] }); describe("Page", () => { it("Filter out partial files", () => __awaiter(void 0, void 0, void 0, function* () { try { const result = yield get_files_1.concatPartials(altSettings); expect(result.files.length).toBe(1); } catch (err) { throw Error(err); } })); it("Should add the contents to the parent", () => __awaiter(void 0, void 0, void 0, function* () { try { const result = yield get_files_1.concatPartials(altSettings); // The order is not correct, but that happens when the files are being loaded. In the mock, order is manual and // won't get ordered anymore. expect(result.files[0].data).toEqual("# Test1\n\n\n# Partial\n\n\n# Another\n"); } catch (err) { throw Error(err); } })); }); //# sourceMappingURL=get-files.spec.js.map