Path: blob/main/tests/smoke/book/render-book.test.ts
12921 views
import { testQuartoCmd } from "../../test.ts";1import { fileExists, noErrorsOrWarnings } from "../../verify.ts";23import { existsSync } from "../../../src/deno_ral/fs.ts";4import { join } from "../../../src/deno_ral/path.ts";5import { docs } from "../../utils.ts";67// Test a simple book8const input = docs("books/simple");9const verifySimple = [10fileExists(join(input, "_book", "Simple.pdf")),11fileExists(join(input, "_book", "index.html")),12fileExists(join(input, "_book", "search.json")),13fileExists(join(input, "_book", "site_libs")),14];15testQuartoCmd(16"render",17[input],18[noErrorsOrWarnings, ...verifySimple],19{20teardown: async () => {21const bookDir = join(input, "_book");22if (existsSync(bookDir)) {23await Deno.remove(bookDir, { recursive: true });24}25},26},27);2829// Test a more complex book render30const vizInput = docs("books/visualization-curriculum");31const verifyViz = [32fileExists(33join(vizInput, "docs", "Visualization-Curriculum.docx"),34),35fileExists(36join(vizInput, "docs", "book-asciidoc", "Visualization-Curriculum.adoc"),37),38fileExists(join(vizInput, "docs", "index.html")),39];40testQuartoCmd(41"render",42[vizInput],43[noErrorsOrWarnings, ...verifyViz],44{45teardown: async () => {46const bookDir = join(vizInput, "docs");47if (existsSync(bookDir)) {48await Deno.remove(bookDir, { recursive: true });49}50},51},52);5354// Note: Typst book tests have been moved to smoke-all infrastructure at55// tests/docs/smoke-all/typst/orange-book/index.qmd565758