From a318b4a366aa1431b77c4bbe3818c9906ce3c3be Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Mon, 30 Sep 2024 16:48:43 +0200 Subject: [PATCH] feat(converter): better test coverage for xmlToString --- .../metadata-converter/src/lib/xml-utils.spec.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/libs/api/metadata-converter/src/lib/xml-utils.spec.ts b/libs/api/metadata-converter/src/lib/xml-utils.spec.ts index 7a0b635ac..33a8b3db0 100644 --- a/libs/api/metadata-converter/src/lib/xml-utils.spec.ts +++ b/libs/api/metadata-converter/src/lib/xml-utils.spec.ts @@ -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': ' & ', + }, + [new XmlText('Text with <, >, &')] + ) const result = xmlToString(textNode) - expect(result).toBe('Text with <, >, &') + expect(result).toBe( + ` +Text with <, >, & +` + ) }) })