The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | |
| 3 | import { hasWideMarkdownBlock } from "./wideMarkdownBlocks"; |
| 4 | |
| 5 | describe("hasWideMarkdownBlock", () => { |
| 6 | it("ignores prose, inline code, and emphasis", () => { |
| 7 | expect(hasWideMarkdownBlock("just a message")).toBe(false); |
| 8 | expect(hasWideMarkdownBlock("I found it in `secteurs_intervention` earlier")).toBe(false); |
| 9 | expect(hasWideMarkdownBlock("a | b in a sentence")).toBe(false); |
| 10 | expect(hasWideMarkdownBlock("an em dash — and a rule\n\n---\n")).toBe(false); |
| 11 | }); |
| 12 | |
| 13 | it("detects indented code blocks", () => { |
| 14 | const prompt = 'before\n\n def search(x):\n return x\n\n"""\n\nafter'; |
| 15 | expect(hasWideMarkdownBlock(prompt)).toBe(true); |
| 16 | expect(hasWideMarkdownBlock("before\n\n\treturn x\n\nafter")).toBe(true); |
| 17 | expect(hasWideMarkdownBlock("before\n\n \treturn x\n\nafter")).toBe(true); |
| 18 | expect(hasWideMarkdownBlock("> return x")).toBe(true); |
| 19 | expect(hasWideMarkdownBlock("> > \treturn x")).toBe(true); |
| 20 | expect(hasWideMarkdownBlock(" 1. indented code")).toBe(true); |
| 21 | expect(hasWideMarkdownBlock(" - code-like bullet")).toBe(true); |
| 22 | expect(hasWideMarkdownBlock("before\n not code\nafter")).toBe(false); |
| 23 | expect(hasWideMarkdownBlock("before\n \nafter")).toBe(false); |
| 24 | expect(hasWideMarkdownBlock("before\n \t\nafter")).toBe(false); |
| 25 | }); |
| 26 | }); |