Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/unit/schema-validation/schema-completions.test.ts
6456 views
1
/*
2
* yaml-intelligence.test.ts
3
*
4
* Copyright (C) 2022 Posit Software, PBC
5
*
6
*/
7
8
import { unitTest } from "../../test.ts";
9
10
import { assert } from "testing/asserts";
11
12
import { initYamlIntelligenceResourcesFromFilesystem } from "../../../src/core/schema/utils.ts";
13
import {
14
initState,
15
setInitializer,
16
} from "../../../src/core/lib/yaml-validation/state.ts";
17
import {
18
schemaCompletions,
19
} from "../../../src/core/lib/yaml-validation/schema-utils.ts";
20
import { Completion } from "../../../src/core/lib/yaml-schema/types.ts";
21
import { getEngineOptionsSchema } from "../../../src/core/lib/yaml-schema/chunk-metadata.ts";
22
23
async function fullInit() {
24
await initYamlIntelligenceResourcesFromFilesystem();
25
}
26
27
unitTest("schema-completions", async () => {
28
setInitializer(fullInit);
29
await initState();
30
31
const schema = (await getEngineOptionsSchema())["knitr"];
32
const completion = schemaCompletions(schema).filter(
33
(c: Completion) => c.value === "tbl-column: ",
34
)[0].description;
35
36
assert(typeof completion === "string");
37
assert(completion.length > 0);
38
});
39
40