From b5a1bb5f6c3c3bb05e5b2be0757a635631f8cd5a Mon Sep 17 00:00:00 2001 From: Kevin Tun Date: Mon, 18 Nov 2024 06:55:15 -0600 Subject: [PATCH] test(parseFormattedStringToDomElements.test.ts): add test case for parsing a string with only formatting tags The new test case ensures that the function parseFormattedStringToDomElements correctly handles a string with only formatting tags. This helps to validate the behavior of the function when dealing with different types of input strings. --- .../__tests__/parseFormattedStringToDomElements.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/ui-common/src/__tests__/parseFormattedStringToDomElements.test.ts b/packages/ui-common/src/__tests__/parseFormattedStringToDomElements.test.ts index d478eade4..917934fe1 100644 --- a/packages/ui-common/src/__tests__/parseFormattedStringToDomElements.test.ts +++ b/packages/ui-common/src/__tests__/parseFormattedStringToDomElements.test.ts @@ -9,7 +9,14 @@ describe("parseFormattedStringToDomElements", () => { expect(result).toHaveLength(1) expect(result[0]).toBe(input) }) - + test("should parse a string with only formatting tags", () => { + const input = "All of this is bold" + const result = parseFormattedStringToDomElements(input) + expect(result).toHaveLength(3) + expect(result[1].type).toBe("b") + expect(result[1].props.children).toHaveLength(1) + expect(result[1].props.children[0]).toBe("All of this is bold") + }) test("should parse a string with a single formatting tag", () => { const input = "This is bold text" const result = parseFormattedStringToDomElements(input)