honkit
Version:
HonKit is building beautiful books using Markdown.
42 lines (41 loc) • 1.41 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsonschema_1 = __importDefault(require("jsonschema"));
const configSchema_1 = __importDefault(require("../configSchema"));
describe("configSchema", () => {
function validate(cfg) {
const v = new jsonschema_1.default.Validator();
return v.validate(cfg, configSchema_1.default, {
propertyName: "config",
});
}
describe("structure", () => {
test("should accept dot in filename", () => {
const result = validate({
structure: {
readme: "book-intro.adoc",
},
});
expect(result.errors.length).toBe(0);
});
test("should accept uppercase in filename", () => {
const result = validate({
structure: {
readme: "BOOK.adoc",
},
});
expect(result.errors.length).toBe(0);
});
test("should not accept filepath", () => {
const result = validate({
structure: {
readme: "folder/myFile.md",
},
});
expect(result.errors.length).toBe(1);
});
});
});