import { toHtml } from "../utils";
import { RichText } from "../types";
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,
},
] as RichText[];
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,
},
] as RichText[];
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,
},
] as RichText[];
describe("Testing html converter", () => {
it("Should return HTML", () => {
expect(toHtml(testRichText)).toEqual(
'NTMS IS AWESOME'
);
});
it("Should return HTML with protected markup for mustache", () => {
expect(toHtml(testRichText2)).toEqual(
"NTMS
test"
);
});
it("Should return HTML with protected markup for mustache", () => {
expect(toHtml(testRichText3)).toEqual(
"I have numbermessage,messages"
);
});
});