test: harden playground structure assertions

This commit is contained in:
Peter Li 2026-07-17 08:32:09 +08:00
parent 34642567ff
commit 525798aa4d

View file

@ -148,9 +148,10 @@ test("the playground fixture covers the supported Markdown elements", async () =
assert.match(playground, /^已解析链接:\[\[Embedded Note\]\]$/m);
assert.match(playground, /^未解析链接:\[\[Missing Note\]\]$/m);
assert.match(playground, /^外部链接:\[Obsidian\]\(https:\/\/obsidian\.md\)$/m);
assert.match(playground, /^> 第一行引用,用于检查纸张折角。$/m);
assert.match(playground, /^> 第二行引用,用于检查连续卡片。$/m);
assert.match(playground, /^> > 嵌套引用只保留外层折角。$/m);
assert.match(
playground,
/^> 第一行引用,用于检查纸张折角。\n> 第二行引用,用于检查连续卡片。\n> > 嵌套引用只保留外层折角。$/m,
);
assert.match(playground, /^1\. 有序列表项$/m);
assert.match(playground, /^ 1\. 嵌套有序列表项$/m);
assert.match(playground, /^2\. 另一个有序列表项$/m);
@ -159,16 +160,9 @@ test("the playground fixture covers the supported Markdown elements", async () =
assert.match(playground, /^- 另一个无序列表项$/m);
assert.match(playground, /^- \[x\] 已完成任务$/m);
assert.match(playground, /^- \[ \] 待完成任务$/m);
assert.match(playground, /^```javascript$/m);
assert.match(playground, /^\/\/ Monokai syntax coverage$/m);
assert.match(playground, /^const accent = "#1677FF";$/m);
assert.match(playground, /^function renderTheme\(name, retries = 3\) \{$/m);
assert.match(playground, /^ return `\$\{name\}:\$\{retries\}`;$/m);
assert.match(playground, /^\}$/m);
assert.match(playground, /^renderTheme\("Aera"\);$/m);
assert.match(
playground,
/^const horizontalScroll = "This intentionally long JavaScript line verifies horizontal scrolling without wrapping in the Aera code block playground\.";$/m,
/^```javascript\n\/\/ Monokai syntax coverage\nconst accent = "#1677FF";\nfunction renderTheme\(name, retries = 3\) \{\n return `\$\{name\}:\$\{retries\}`;\n\}\nrenderTheme\("Aera"\);\nconst horizontalScroll = "This intentionally long JavaScript line verifies horizontal scrolling without wrapping in the Aera code block playground\.";\n```(?=\n\n```\n无语言代码块用于检查普通文本。\n```$)/m,
);
assert.equal(playground.match(/^---$/gm)?.length, 3);
assert.match(
@ -187,7 +181,10 @@ test("the playground fixture covers the supported Markdown elements", async () =
"quote",
"tip",
]) {
assert.match(playground, new RegExp(`^> \\[!${calloutType}\\]`, "m"));
assert.match(
playground,
new RegExp(`^> \\[!${calloutType}\\](?:[+-])?(?: .*)?$`, "m"),
);
}
assert.match(playground, /^> \[!tip\]- 收起的提示$/m);
assert.match(playground, /^\| 元素 \| 状态 \| 用途 \|$/m);