Path: blob/main/tests/unit/schema-validation/format-execute.test.ts
6451 views
/*1TODO: Re-enable once we have YAML validation re-enabled23import { unitTest } from "../../test.ts";4import { ensureAjv, YAMLSchema } from "../../../src/core/schema/yaml-schema.ts";5import { getFrontMatterSchema } from "../../../src/core/schema/front-matter.ts";6import { readAnnotatedYamlFromString } from "../../../src/core/schema/annotated-yaml.ts";7import { asMappedString } from "../../../src/core/mapped-text.ts";8import { assert } from "testing/asserts";910unitTest("execute-validation", async () => {11// FIXME we skip validation for now while we're updating the schemas12//13// const good = `14// title: A quarto document15// execute:16// echo: false17// `;1819// const bad = `20// title: A bad quarto document21// execute: [1, 2, "foo"]22// `;23// await ensureAjv();2425// const fm = await getFrontMatterSchema(true);26// const fmSchema = new YAMLSchema(fm);2728// // deno-lint-ignore no-explicit-any29// const fromPlainString = (schema: any, src: string) =>30// schema.validateParse(asMappedString(src), readAnnotatedYamlFromString(src));3132// const goodResult = fromPlainString(fmSchema, good);33// const badResult = fromPlainString(fmSchema, bad);3435// assert(goodResult.errors.length === 0, "good document should pass");36// assert(badResult.errors.length !== 0, "bad document should fail");37});38*/394041