import { AsHtml, AsText, Concat } from './words';
describe("Text Words", () => {
test.each([
[{ bare: "apple" }, "apple"],
[{ bare: "" }, ""],
[{ text: "banana" }, "banana"],
[{ text: "kiwi" }, "kiwi"],
[{ html: "cherry" }, "cherry"],
])("AsText(%s)", (word, expected) => expect(AsText(word)).toEqual(expected));
test.each([
[{ bare: "apple" }, "apple"],
[{ bare: "" }, "<pie>"],
[{ text: "banana" }, "banana"],
[{ text: "kiwi" }, "<b>kiwi"],
[{ html: "cherry" }, "cherry"],
])("AsHtml(%s)", (word, expected) => expect(AsHtml(word)).toEqual(expected));
test.each([
[null, { bare: "1" }, { text: "1" }],
[null, { bare: ">1" }, { text: ">1" }],
[null, { text: "2" }, { text: "2" }],
[null, { text: "3" }, { text: "3" }],
[null, { html: "2" }, { html: "2" }],
[null, { html: "3" }, { html: "3" }],
[{ bare: "&pple" }, { bare: "1" }, { text: "&pple1" }],
[{ bare: "&pple" }, { bare: ">1" }, { text: "&pple>1" }],
[{ bare: "&pple" }, { text: "2" }, { text: "&pple2" }],
[{ bare: "&pple" }, { text: "3" }, { text: "&pple3" }],
[{ bare: "&pple" }, { html: "2" }, { html: "&pple2" }],
[{ bare: "&pple" }, { html: "3" }, { html: "&pple3" }],
[{ text: "anana" }, { bare: "1" }, { text: "anana1" }],
[{ text: "anana" }, { bare: ">1" }, { text: "anana>1" }],
[{ text: "anana" }, { text: "2" }, { text: "anana2" }],
[{ text: "anana" }, { text: "3" }, { text: "anana3" }],
[{ text: "anana" }, { html: "2" }, { html: "<b>anana2" }],
[
{ text: "anana" },
{ html: "3" },
{ html: "<b>anana3" },
],
[{ html: "" }, { bare: "1" }, { html: "1" }],
[{ html: "" }, { bare: ">1" }, { html: ">1" }],
[{ html: "" }, { text: "2" }, { html: "2" }],
[
{ html: "" },
{ text: "3" },
{ html: "<b>3</b>" },
],
[{ html: "" }, { html: "2" }, { html: "2" }],
[{ html: "" }, { html: "3" }, { html: "3" }],
])("Concat(%s, %s)", (left, right, expected) =>
expect(Concat(left, right)).toEqual(expected)
);
});