The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | import { parseMarkdownDocument } from "../../lib/markdownDocument"; |
| 3 | import { pullRequestDescriptionContent } from "./pullRequestDescriptionContent"; |
| 4 | |
| 5 | describe("pull request description content", () => { |
| 6 | it("ignores malformed image URLs while keeping the description and valid attachments", () => { |
| 7 | const result = pullRequestDescriptionContent( |
| 8 | parseMarkdownDocument( |
| 9 | [ |
| 10 | "The pull request remains readable.", |
| 11 | "", |
| 12 | "", |
| 13 | '<img src="https://:80" alt="Invalid port">', |
| 14 | "", |
| 15 | "", |
| 16 | ].join("\n\n"), |
| 17 | ), |
| 18 | ); |
| 19 | |
| 20 | expect(result.attachments).toEqual([ |
| 21 | { uri: "http://example.com/screenshot.png", caption: "Screenshot", kind: "image" }, |
| 22 | ]); |
| 23 | expect(result.preview).toContain("The pull request remains readable."); |
| 24 | }); |
| 25 | |
| 26 | it("keeps screenshot attachments and does not turn code examples or local paths into media", () => { |
| 27 | const result = pullRequestDescriptionContent( |
| 28 | parseMarkdownDocument( |
| 29 | [ |
| 30 | "Fixes reconnects.", |
| 31 | "```markdown\n\n```", |
| 32 | "", |
| 33 | "", |
| 34 | "", |
| 35 | "", |
| 36 | ].join("\n\n"), |
| 37 | ), |
| 38 | ); |
| 39 | expect(result.attachments).toEqual([ |
| 40 | { uri: "https://example.com/before.png", caption: "Before", kind: "image" }, |
| 41 | { uri: "https://example.com/after.png", caption: "After", kind: "image" }, |
| 42 | ]); |
| 43 | expect(result.preview).toContain("Fixes reconnects."); |
| 44 | expect(result.preview).not.toContain("Duplicate"); |
| 45 | }); |
| 46 | }); |