import { describe, expect, it } from "vitest"; import { hasStructure, htmlToMarkdown } from "./pasteMarkdown"; describe("a formatted paste keeps its levels", () => { it("reads ChatGPT and Claude: headings and lists inside lists", () => { const html = `

الفصل الأول: النفايات

  1. أنواع النفايات
  2. التخلص الآمن
`; expect(hasStructure(html)).toBe(true); expect(htmlToMarkdown(html)).toBe( "## الفصل الأول: النفايات\n1. أنواع النفايات\n - النفايات **البيولوجية**\n - النفايات الكيميائية\n1. التخلص الآمن", ); }); it("reads Word: heading styles and list paragraphs by their level, without the drawn bullet", () => { const html = `

الفصل: عندما تحدث المخاطر

1. أنواع النفايات

·  النفايات البيولوجية

نص عادي

`; expect(htmlToMarkdown(html)).toBe( "# الفصل: عندما تحدث المخاطر\n- أنواع النفايات\n - النفايات البيولوجية\nنص عادي", ); }); it("keeps the bullet of a list item whose words sit in a

(ChatGPT, Claude)", () => { const html = `

TAZA | طازة

Brand Identity Design Brief

2. طبيعة النشاط

المشروع عبارة عن منظومة متكاملة تشمل:

نص بعدها

`; expect(htmlToMarkdown(html)).toBe( "# TAZA | طازة\n**Brand Identity Design Brief**\n### 2. طبيعة النشاط\n" + "المشروع عبارة عن منظومة متكاملة تشمل:\n- محلات وفروع فعلية.\n- تطبيق موبايل.\n" + " - طلب أونلاين\nنص بعدها", ); }); it("leaves a paste with no structure to the box", () => { expect(hasStructure("

سطر

سطر آخر

")).toBe(false); }); });