UNPKG

honkit

Version:

HonKit is building beautiful books using Markdown.

100 lines (99 loc) 4.04 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 promise_1 = __importDefault(require("../../utils/promise")); const plugin_1 = __importDefault(require("../../models/plugin")); const validatePlugin_1 = __importDefault(require("../validatePlugin")); describe("validatePlugin", () => { test("must not validate a not loaded plugin", () => { const plugin = plugin_1.default.createFromString("test"); return (0, validatePlugin_1.default)(plugin).then(() => { throw new Error("Should not be validate"); }, (err) => { return (0, promise_1.default)(); }); }); test("alpha plugin can loaded plugin", () => { const testPkgRequireAlphaVersion = { title: "Disqus", name: "gitbook-plugin-disqus", description: "Disqus comments thread in the footer of your pages", icon: "./icon.png", main: "index.js", browser: "./_assets/plugin.js", version: "1.0.1", engines: { gitbook: ">=4.0.0-alpha", }, dependencies: { react: "^15.3.2", "react-disqus-thread": "^0.4.0", }, devDependencies: { "gitbook-plugin": "^4.0.0-alpha.0", eslint: "3.7.1", "eslint-config-gitbook": "1.4.0", }, homepage: "https://github.com/GitbookIO/plugin-disqus", repository: { type: "git", url: "https://github.com/GitbookIO/plugin-disqus.git", }, license: "Apache-2.0", bugs: { url: "https://github.com/GitbookIO/plugin-disqus/issues", }, keywords: ["gitbook:social"], scripts: { "build-js": "gitbook-plugin build ./src/index.js ./_assets/plugin.js", prepublish: "npm run build-js", }, gitbook: { properties: { shortName: { type: "string", title: "Website Shortname", description: "Unique identifier for your website as registered on Disqus", required: true, }, useIdentifier: { type: "boolean", title: "Pass page identifier option to Disqus", default: false, }, }, page: { title: "Disqus configuration for this page", properties: { disqus: { type: "object", properties: { enabled: { type: "boolean", title: "Enable Disqus comments for this page.", default: true, }, identifier: { type: "string", title: "Identifier for this page.", description: "Tells the Disqus service how to identify the current page", }, }, }, }, }, }, }; const plugin = new plugin_1.default({ name: "test", version: "4.0.0", path: "/", package: immutable_1.default.fromJS(testPkgRequireAlphaVersion), content: immutable_1.default.fromJS({}), }); return (0, validatePlugin_1.default)(plugin); }); });