import { toRichText } from "../utils"; const testRichText = [ { type: "text", plain_text: "NTMS", annotations: { bold: true, italic: false, strikethrough: false, underline: false, code: false, color: "default", }, href: "https://ntms.dev", }, { type: "text", plain_text: " IS AWESOME", annotations: { bold: false, italic: false, strikethrough: false, underline: true, code: false, color: "red", }, href: null, }, ]; const testRichText2 = [ { type: "text", plain_text: "{{NTMS}}", annotations: { bold: true, italic: false, strikethrough: false, underline: false, code: true, color: "default", }, href: null, }, { type: "text", plain_text: "{{test}}", annotations: { bold: false, italic: false, strikethrough: false, underline: false, code: false, color: "default", }, href: null, }, ]; const testRichText3 = [ { type: "text", plain_text: "I have {{number}}", annotations: { bold: true, italic: false, strikethrough: false, underline: false, code: false, color: "default", }, href: null, }, { type: "text", plain_text: "((message,messages))", annotations: { bold: false, italic: false, strikethrough: false, underline: false, code: false, color: "default", }, href: null, }, ]; const testHtml = `NTMS IS AWESOME`; const testHtml2 = "
NTMS
test"; const testHtml3 = `I have numbermessage,messages`; describe("To plain text", () => { it("Should transform html to rich text", () => { expect(toRichText(testHtml)).toEqual(testRichText); }); it("Should return a rich text with mustach", () => { expect(toRichText(testHtml2)).toEqual(testRichText2); }); it("Should return a rich text with mustach and plural", () => { expect(toRichText(testHtml3)).toEqual(testRichText3); }); });