feat(view,tests): query blocks stay code in text the agent did not write

This commit is contained in:
hh committed 2026-10-13 01:23:49 +02:00
1 parent 43d1e1a4a3
commit 91699a382e
5 files changed
+66 -4

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
import { describe, expect, it } from "vitest";
import { inertFences } from "$lib/panel/fences";
const runs = (language: string) => ["tasks", "dataview"].includes(language);
describe("inertFences", () => {
it("turns a query block into code", () => {
expect(inertFences("```tasks\nnot done\n```", runs)).toBe(
"```text\nnot done\n```"
);
expect(inertFences("~~~Dataview\nlist\n~~~", runs)).toBe(
"~~~text\nlist\n~~~"
);
});
it("reaches a block opened inside a list item or a quote", () => {
expect(inertFences("+ ```tasks\n+ not done", runs)).toBe(
"+ ```text\n+ not done"
);
expect(inertFences("> 1. ````tasks {x}", runs)).toBe("> 1. ````text {x}");
});
it("leaves ordinary code and closing fences alone", () => {
const text = "```python\nprint(1)\n```\ninline `tasks` stays";
expect(inertFences(text, runs)).toBe(text);
});
});