Path: blob/main/tests/smoke/inspect/inspect-recursive-include.test.ts
12925 views
/*1* inspect-recursive-include.test.ts2*3* Copyright (C) 2020-2024 Posit Software, PBC4*5*/6import { assertObjectMatch } from "https://deno.land/[email protected]/assert/assert_object_match.ts";7import { existsSync } from "../../../src/deno_ral/fs.ts";8import { FileInclusion } from "../../../src/project/types.ts";9import {10ExecuteOutput,11testQuartoCmd,12} from "../../test.ts";13import { assert, assertEquals } from "testing/asserts";1415(() => {16const input = "docs/websites/issue-9253/index.qmd";17const output = "docs/websites/issue-9253/index.json";18testQuartoCmd(19"inspect",20[input, output],21[22{23name: "inspect-include",24verify: async (outputs: ExecuteOutput[]) => {25assert(existsSync(output));26const json = JSON.parse(Deno.readTextFileSync(output));27const info = json.fileInformation["docs/websites/issue-9253/index.qmd"];28const includeMap: FileInclusion[] = info.includeMap;29assertObjectMatch(info.includeMap[0], { target: "_include.qmd" });30assertObjectMatch(info.includeMap[1], { source: "_include.qmd", target: "_include2.qmd" });31}32}33],34{35teardown: async () => {36if (existsSync(output)) {37Deno.removeSync(output);38}39}40},41);42})();434445