Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/inspect/inspect-include.test.ts
12921 views
1
/*
2
* inspect-include.test.ts
3
*
4
* Copyright (C) 2020-2024 Posit Software, PBC
5
*
6
*/
7
import { assertObjectMatch } from "https://deno.land/[email protected]/assert/assert_object_match.ts";
8
import { existsSync } from "../../../src/deno_ral/fs.ts";
9
import {
10
ExecuteOutput,
11
testQuartoCmd,
12
} from "../../test.ts";
13
import { assert } from "testing/asserts";
14
15
(() => {
16
const input = "docs/inspect/foo.qmd";
17
const output = "docs/inspect/foo.json";
18
testQuartoCmd(
19
"inspect",
20
[input, output],
21
[
22
{
23
name: "inspect-include",
24
verify: async (outputs: ExecuteOutput[]) => {
25
assert(existsSync("docs/inspect/foo.json"));
26
const json = JSON.parse(Deno.readTextFileSync("docs/inspect/foo.json"));
27
assertObjectMatch(json.fileInformation["docs/inspect/foo.qmd"].includeMap[0],
28
{
29
source: input,
30
target: "_bar.qmd"
31
});
32
}
33
}
34
],
35
{
36
teardown: async () => {
37
if (existsSync("docs/inspect/foo.json")) {
38
Deno.removeSync("docs/inspect/foo.json");
39
}
40
}
41
},
42
);
43
})();
44
45