perf(test): fold markdown list spacing into nested lists suite

This commit is contained in:
Peter Steinberger
2026-02-16 00:42:13 +00:00
parent 0e4eada580
commit e64dd7b56a
2 changed files with 31 additions and 33 deletions

View File

@@ -1,33 +0,0 @@
import { describe, it, expect } from "vitest";
import { markdownToIR } from "./ir.js";
describe("list paragraph spacing", () => {
it("adds blank line between bullet list and following paragraph", () => {
const input = `- item 1
- item 2
Paragraph after`;
const result = markdownToIR(input);
// Should have two newlines between "item 2" and "Paragraph"
expect(result.text).toContain("item 2\n\nParagraph");
});
it("adds blank line between ordered list and following paragraph", () => {
const input = `1. item 1
2. item 2
Paragraph after`;
const result = markdownToIR(input);
expect(result.text).toContain("item 2\n\nParagraph");
});
it("does not produce triple newlines", () => {
const input = `- item 1
- item 2
Paragraph after`;
const result = markdownToIR(input);
// Should NOT have three consecutive newlines
expect(result.text).not.toContain("\n\n\n");
});
});

View File

@@ -299,3 +299,34 @@ describe("Nested Lists - Edge Cases", () => {
expect(result.text).toBe(expected);
});
});
describe("list paragraph spacing", () => {
it("adds blank line between bullet list and following paragraph", () => {
const input = `- item 1
- item 2
Paragraph after`;
const result = markdownToIR(input);
// Should have two newlines between "item 2" and "Paragraph"
expect(result.text).toContain("item 2\n\nParagraph");
});
it("adds blank line between ordered list and following paragraph", () => {
const input = `1. item 1
2. item 2
Paragraph after`;
const result = markdownToIR(input);
expect(result.text).toContain("item 2\n\nParagraph");
});
it("does not produce triple newlines", () => {
const input = `- item 1
- item 2
Paragraph after`;
const result = markdownToIR(input);
// Should NOT have three consecutive newlines
expect(result.text).not.toContain("\n\n\n");
});
});