Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/yaml-intelligence/yaml-intelligence-folded-block-strings.test.ts
6449 views
1
/*
2
* yaml-intelligence-embedded-html.test.ts
3
*
4
* Copyright (C) 2022 Posit Software, PBC
5
*
6
*/
7
8
const yamlStr = `
9
format:
10
html:
11
toc-title: >
12
Contents
13
`;
14
15
import { unitTest } from "../../test.ts";
16
import { assert } from "testing/asserts";
17
import { initYamlIntelligenceResourcesFromFilesystem } from "../../../src/core/schema/utils.ts";
18
import {
19
initState,
20
setInitializer,
21
} from "../../../src/core/lib/yaml-validation/state.ts";
22
import { readAndValidateYamlFromMappedString } from "../../../src/core/lib/yaml-schema/validated-yaml.ts";
23
import { asMappedString } from "../../../src/core/lib/mapped-text.ts";
24
25
import { getProjectConfigSchema } from "../../../src/core/lib/yaml-schema/project-config.ts";
26
27
async function fullInit() {
28
await initYamlIntelligenceResourcesFromFilesystem();
29
}
30
31
unitTest("yaml-intelligence-folded-block-strings", async () => {
32
setInitializer(fullInit);
33
await initState();
34
const configSchema = await getProjectConfigSchema();
35
36
const { yamlValidationErrors } = await readAndValidateYamlFromMappedString(
37
asMappedString(yamlStr),
38
configSchema,
39
);
40
41
assert(yamlValidationErrors.length === 0);
42
});
43
44