


























@@ -53,7 +53,7 @@ describe("markdownToIR tableMode bullets", () => {
5353expect(ir.text).toContain("| A | B |");
5454expect(ir.text).toContain("| 1 | 2 |");
5555expect(ir.text).not.toContain("•");
56-expect(ir.styles.some((style) => style.style === "code_block")).toBe(false);
56+expect(ir.styles.map((style) => style.style)).not.toContain("code_block");
5757});
58585959it("handles empty cells gracefully", () => {
@@ -81,10 +81,11 @@ describe("markdownToIR tableMode bullets", () => {
8181const ir = markdownToIR(md, { tableMode: "bullets" });
82828383// Should have bold style for row label
84-const hasRowLabelBold = ir.styles.some(
85-(s) => s.style === "bold" && ir.text.slice(s.start, s.end) === "Row1",
86-);
87-expect(hasRowLabelBold).toBe(true);
84+expect(
85+ir.styles
86+.filter((style) => style.style === "bold")
87+.map((style) => ir.text.slice(style.start, style.end)),
88+).toContain("Row1");
8889});
89909091it("renders tables as code blocks in code mode", () => {
@@ -98,7 +99,7 @@ describe("markdownToIR tableMode bullets", () => {
989999100expect(ir.text).toContain("| A | B |");
100101expect(ir.text).toContain("| 1 | 2 |");
101-expect(ir.styles.some((style) => style.style === "code_block")).toBe(true);
102+expect(ir.styles.map((style) => style.style)).toContain("code_block");
102103});
103104104105it("preserves inline styles and links in bullets mode", () => {
@@ -110,10 +111,11 @@ describe("markdownToIR tableMode bullets", () => {
110111111112const ir = markdownToIR(md, { tableMode: "bullets" });
112113113-const hasItalic = ir.styles.some(
114-(s) => s.style === "italic" && ir.text.slice(s.start, s.end) === "Row",
115-);
116-expect(hasItalic).toBe(true);
117-expect(ir.links.some((link) => link.href === "https://example.com")).toBe(true);
114+expect(
115+ir.styles
116+.filter((style) => style.style === "italic")
117+.map((style) => ir.text.slice(style.start, style.end)),
118+).toContain("Row");
119+expect(ir.links.map((link) => link.href)).toContain("https://example.com");
118120});
119121});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。