Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/unit/schema-validation/format-execute.test.ts
6451 views
1
/*
2
TODO: Re-enable once we have YAML validation re-enabled
3
4
import { unitTest } from "../../test.ts";
5
import { ensureAjv, YAMLSchema } from "../../../src/core/schema/yaml-schema.ts";
6
import { getFrontMatterSchema } from "../../../src/core/schema/front-matter.ts";
7
import { readAnnotatedYamlFromString } from "../../../src/core/schema/annotated-yaml.ts";
8
import { asMappedString } from "../../../src/core/mapped-text.ts";
9
import { assert } from "testing/asserts";
10
11
unitTest("execute-validation", async () => {
12
// FIXME we skip validation for now while we're updating the schemas
13
//
14
// const good = `
15
// title: A quarto document
16
// execute:
17
// echo: false
18
// `;
19
20
// const bad = `
21
// title: A bad quarto document
22
// execute: [1, 2, "foo"]
23
// `;
24
// await ensureAjv();
25
26
// const fm = await getFrontMatterSchema(true);
27
// const fmSchema = new YAMLSchema(fm);
28
29
// // deno-lint-ignore no-explicit-any
30
// const fromPlainString = (schema: any, src: string) =>
31
// schema.validateParse(asMappedString(src), readAnnotatedYamlFromString(src));
32
33
// const goodResult = fromPlainString(fmSchema, good);
34
// const badResult = fromPlainString(fmSchema, bad);
35
36
// assert(goodResult.errors.length === 0, "good document should pass");
37
// assert(badResult.errors.length !== 0, "bad document should fail");
38
});
39
*/
40
41