Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/book/book-404-detection.test.ts
12921 views
1
import { testQuartoCmd } from "../../test.ts";
2
import { fileExists, noErrorsOrWarnings } from "../../verify.ts";
3
import { existsSync } from "../../../src/deno_ral/fs.ts";
4
import { join } from "../../../src/deno_ral/path.ts";
5
import { docs } from "../../utils.ts";
6
7
// Test that book 404 page with .ipynb extension is detected
8
const inputIpynb = docs("books/book-404-detection");
9
const outputDirIpynb = join(inputIpynb, "_book");
10
11
testQuartoCmd(
12
"render",
13
[inputIpynb],
14
[
15
noErrorsOrWarnings,
16
fileExists(join(outputDirIpynb, "index.html")),
17
fileExists(join(outputDirIpynb, "chapter1.html")),
18
fileExists(join(outputDirIpynb, "404.html")),
19
fileExists(join(outputDirIpynb, "search.json")),
20
],
21
{
22
teardown: async () => {
23
if (existsSync(outputDirIpynb)) {
24
await Deno.remove(outputDirIpynb, { recursive: true });
25
}
26
},
27
},
28
);
29
30
// Test that book 404 page with .rmd extension is detected
31
const inputRmd = docs("books/book-404-rmd");
32
const outputDirRmd = join(inputRmd, "_book");
33
34
testQuartoCmd(
35
"render",
36
[inputRmd],
37
[
38
noErrorsOrWarnings,
39
fileExists(join(outputDirRmd, "index.html")),
40
fileExists(join(outputDirRmd, "chapter1.html")),
41
fileExists(join(outputDirRmd, "404.html")),
42
fileExists(join(outputDirRmd, "search.json")),
43
],
44
{
45
teardown: async () => {
46
if (existsSync(outputDirRmd)) {
47
await Deno.remove(outputDirRmd, { recursive: true });
48
}
49
},
50
},
51
);
52
53