Skip to content

Commit

Permalink
test(parseFormattedStringToDomElements.test.ts): add test case for pa…
Browse files Browse the repository at this point in the history
…rsing 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.
  • Loading branch information
ktun95 committed Nov 18, 2024
1 parent c18854b commit b5a1bb5
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "<b>All of this is bold</b>"
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 <b>bold</b> text"
const result = parseFormattedStringToDomElements(input)
Expand Down

0 comments on commit b5a1bb5

Please sign in to comment.