Skip to content

Commit

Permalink
feat(converter): better test coverage for xmlToString
Browse files Browse the repository at this point in the history
  • Loading branch information
jahow committed Sep 30, 2024
1 parent 9a84ddd commit a318b4a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions libs/api/metadata-converter/src/lib/xml-utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,21 @@ end.
})

it('should properly escape special characters in text', () => {
const textNode = new XmlText('Text with <, >, &')
const textNode = new XmlElement(
'test',
{
'my-attribute': '<Attribute> & <value>',
},
[new XmlText('Text with <, >, &')]
)

const result = xmlToString(textNode)

expect(result).toBe('Text with &lt;, &gt;, &amp;')
expect(result).toBe(
`
<test my-attribute="&lt;Attribute&gt; &amp; &lt;value&gt;">Text with &lt;, &gt;, &amp;</test>
`
)
})
})

Expand Down

0 comments on commit a318b4a

Please sign in to comment.