mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 06:30:43 +00:00
test: clarify markdown assertion lists
This commit is contained in:
@@ -53,7 +53,7 @@ describe("markdownToIR tableMode bullets", () => {
|
||||
expect(ir.text).toContain("| A | B |");
|
||||
expect(ir.text).toContain("| 1 | 2 |");
|
||||
expect(ir.text).not.toContain("•");
|
||||
expect(ir.styles.some((style) => style.style === "code_block")).toBe(false);
|
||||
expect(ir.styles.map((style) => style.style)).not.toContain("code_block");
|
||||
});
|
||||
|
||||
it("handles empty cells gracefully", () => {
|
||||
@@ -81,10 +81,11 @@ describe("markdownToIR tableMode bullets", () => {
|
||||
const ir = markdownToIR(md, { tableMode: "bullets" });
|
||||
|
||||
// Should have bold style for row label
|
||||
const hasRowLabelBold = ir.styles.some(
|
||||
(s) => s.style === "bold" && ir.text.slice(s.start, s.end) === "Row1",
|
||||
);
|
||||
expect(hasRowLabelBold).toBe(true);
|
||||
expect(
|
||||
ir.styles
|
||||
.filter((style) => style.style === "bold")
|
||||
.map((style) => ir.text.slice(style.start, style.end)),
|
||||
).toContain("Row1");
|
||||
});
|
||||
|
||||
it("renders tables as code blocks in code mode", () => {
|
||||
@@ -98,7 +99,7 @@ describe("markdownToIR tableMode bullets", () => {
|
||||
|
||||
expect(ir.text).toContain("| A | B |");
|
||||
expect(ir.text).toContain("| 1 | 2 |");
|
||||
expect(ir.styles.some((style) => style.style === "code_block")).toBe(true);
|
||||
expect(ir.styles.map((style) => style.style)).toContain("code_block");
|
||||
});
|
||||
|
||||
it("preserves inline styles and links in bullets mode", () => {
|
||||
@@ -110,10 +111,11 @@ describe("markdownToIR tableMode bullets", () => {
|
||||
|
||||
const ir = markdownToIR(md, { tableMode: "bullets" });
|
||||
|
||||
const hasItalic = ir.styles.some(
|
||||
(s) => s.style === "italic" && ir.text.slice(s.start, s.end) === "Row",
|
||||
);
|
||||
expect(hasItalic).toBe(true);
|
||||
expect(ir.links.some((link) => link.href === "https://example.com")).toBe(true);
|
||||
expect(
|
||||
ir.styles
|
||||
.filter((style) => style.style === "italic")
|
||||
.map((style) => ir.text.slice(style.start, style.end)),
|
||||
).toContain("Row");
|
||||
expect(ir.links.map((link) => link.href)).toContain("https://example.com");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("renderMarkdownIRChunksWithinLimit", () => {
|
||||
|
||||
expect(chunks.map((chunk) => chunk.source.text)).toEqual(["alpha ", "<<"]);
|
||||
expect(chunks.map((chunk) => chunk.source.text).join("")).toBe("alpha <<");
|
||||
expect(chunks.every((chunk) => chunk.rendered.length <= 8)).toBe(true);
|
||||
expect(chunks.filter((chunk) => chunk.rendered.length > 8)).toEqual([]);
|
||||
});
|
||||
|
||||
it("preserves formatting when a rendered chunk is re-split", () => {
|
||||
@@ -46,8 +46,8 @@ describe("renderMarkdownIRChunksWithinLimit", () => {
|
||||
});
|
||||
|
||||
expect(chunks.map((chunk) => chunk.source.text)).toEqual(["Which of ", "these"]);
|
||||
expect(chunks.every((chunk) => chunk.rendered.startsWith("<b>"))).toBe(true);
|
||||
expect(chunks.every((chunk) => chunk.rendered.endsWith("</b>"))).toBe(true);
|
||||
expect(chunks.filter((chunk) => !chunk.rendered.startsWith("<b>"))).toEqual([]);
|
||||
expect(chunks.filter((chunk) => !chunk.rendered.endsWith("</b>"))).toEqual([]);
|
||||
});
|
||||
|
||||
it("checks exact candidates instead of assuming rendered length is monotonic", () => {
|
||||
|
||||
Reference in New Issue
Block a user