1- /* eslint-disable jest/no-commented-out-tests */
21// import he from 'he';
32
43import { parse } from '../parse' ;
@@ -18,7 +17,7 @@ describe('XMLParser', () => {
1817 } ,
1918 } ;
2019
21- let result = parse ( xmlData , {
20+ const result = parse ( xmlData , {
2221 attributeNamePrefix : '' ,
2322 ignoreAttributes : false ,
2423 dynamicTypingAttributeValue : true ,
@@ -42,7 +41,7 @@ describe('XMLParser', () => {
4241 } ,
4342 } ;
4443
45- let result = parse ( xmlData , {
44+ const result = parse ( xmlData , {
4645 attributeNamePrefix : '' ,
4746 ignoreAttributes : false ,
4847 dynamicTypingAttributeValue : true ,
@@ -66,7 +65,7 @@ describe('XMLParser', () => {
6665 } ,
6766 } ;
6867
69- let result = parse ( xmlData , {
68+ const result = parse ( xmlData , {
7069 attributeNamePrefix : '' ,
7170 ignoreAttributes : false ,
7271 dynamicTypingAttributeValue : true ,
@@ -91,7 +90,7 @@ describe('XMLParser', () => {
9190 } ,
9291 } ;
9392
94- let result = parse ( xmlData , {
93+ const result = parse ( xmlData , {
9594 attributeNamePrefix : '' ,
9695 ignoreAttributes : false ,
9796 dynamicTypingAttributeValue : true ,
@@ -118,7 +117,7 @@ describe('XMLParser', () => {
118117 } ,
119118 } ;
120119
121- let result = parse ( xmlData , {
120+ const result = parse ( xmlData , {
122121 attributeNamePrefix : '' ,
123122 ignoreAttributes : false ,
124123 } ) ;
@@ -143,181 +142,12 @@ describe('XMLParser', () => {
143142 } ,
144143 } ;
145144
146- let result = parse ( xmlData , {
145+ const result = parse ( xmlData , {
147146 attributeNamePrefix : '' ,
148147 ignoreAttributes : false ,
149148 ignoreNameSpace : true ,
150149 } ) ;
151150
152151 expect ( result ) . toStrictEqual ( expected ) ;
153-
154- // result = validator.validate(xmlData, {
155- // allowBooleanAttributes: true,
156- // });
157- // // expect(result).toBe(true);
158152 } ) ;
159-
160- // it('should not parse attributes with name start with number', () => {
161- // const xmlData = encoder.encode(
162- // `<issue 35entity="Mjg2MzY2OTkyNA==" ></issue>`,
163- // );
164-
165- // const expected = {
166- // err: {
167- // code: 'InvalidAttr',
168- // msg: "Attribute '35entity' is an invalid name.",
169- // line: 1,
170- // },
171- // };
172- // const result = validator.validate(xmlData);
173-
174- // expect(result).toStrictEqual(expected);
175- // });
176-
177- // it('should not parse attributes with invalid char', () => {
178- // const xmlData = encoder.encode(
179- // `<issue enti+ty="Mjg2MzY2OTkyNA=="></issue>`,
180- // );
181- // const expected = {
182- // err: {
183- // code: 'InvalidAttr',
184- // msg: "Attribute 'enti+ty' is an invalid name.",
185- // line: 1,
186- // },
187- // };
188-
189- // const result = validator.validate(xmlData);
190-
191- // expect(result).toStrictEqual(expected);
192- // });
193-
194- // it('should not parse attributes in closing tag', () => {
195- // const xmlData = encoder.encode(`<issue></issue invalid="true">`);
196- // const expected = {
197- // err: {
198- // code: 'InvalidTag',
199- // msg: "Closing tag 'issue' can't have attributes or invalid starting.",
200- // line: 1,
201- // },
202- // };
203- // const result = validator.validate(xmlData);
204-
205- // expect(result).toStrictEqual(expected);
206- // });
207-
208- // it('should err for invalid atributes', () => {
209- // const xmlData = encoder.encode(`<rootNode =''></rootNode>`);
210- // const expected = {
211- // err: {
212- // code: 'InvalidAttr',
213- // msg: "Attribute '''' has no space in starting.",
214- // line: 1,
215- // },
216- // };
217- // const result = validator.validate(xmlData);
218- // expect(result).toStrictEqual(expected);
219- // });
220-
221- // it('should validate xml with atributes', () => {
222- // const xmlData = encoder.encode(
223- // `<rootNode attr="123"><tag></tag><tag>1</tag><tag>val</tag></rootNode>`,
224- // );
225-
226- // const result = validator.validate(xmlData);
227- // expect(result).toBe(true);
228- // });
229-
230- // it("should validate xml atribute has '>' in value", () => {
231- // const xmlData = encoder.encode(
232- // `<rootNode attr="123>234"><tag></tag><tag>1</tag><tag>val</tag></rootNode>`,
233- // );
234-
235- // const result = validator.validate(xmlData);
236- // expect(result).toBe(true);
237- // });
238-
239- // it('should not validate xml with invalid atributes', () => {
240- // const xmlData = encoder.encode(
241- // `<rootNode attr="123><tag></tag><tag>1</tag><tag>val</tag></rootNode>`,
242- // );
243- // const expected = {
244- // err: {
245- // code: 'InvalidAttr',
246- // msg: "Attributes for 'rootNode' have open quote.",
247- // line: 1,
248- // },
249- // };
250- // const result = validator.validate(xmlData);
251- // expect(result).toStrictEqual(expected);
252- // });
253-
254- // it('should not validate xml with invalid attributes when duplicate attributes present', () => {
255- // const xmlData = encoder.encode(`<rootNode abc='123' abc="567" />`);
256- // const expected = {
257- // err: {
258- // code: 'InvalidAttr',
259- // msg: "Attribute 'abc' is repeated.",
260- // line: 1,
261- // },
262- // };
263- // const result = validator.validate(xmlData);
264- // //console.log(JSON.stringify(result,null,4));
265- // expect(result).toStrictEqual(expected);
266- // });
267-
268- // it('should not validate xml with invalid attributes when no space between 2 attributes', () => {
269- // const xmlData = encoder.encode(`<rootNode abc='123'bc='567' />`);
270- // const expected = {
271- // err: {
272- // code: 'InvalidAttr',
273- // msg: "Attribute 'bc' has no space in starting.",
274- // line: 1,
275- // },
276- // };
277- // const result = validator.validate(xmlData);
278- // expect(result).toStrictEqual(expected);
279- // });
280-
281- // it('should not validate a tag with attribute presents without value', () => {
282- // const xmlData = encoder.encode(`<rootNode ab cd='ef'></rootNode>`);
283- // const expected = {
284- // err: {
285- // code: 'InvalidAttr',
286- // msg: "boolean attribute 'ab' is not allowed.",
287- // line: 1,
288- // },
289- // };
290- // const result = validator.validate(xmlData);
291- // expect(result).toStrictEqual(expected);
292- // });
293-
294- // it('should not validate xml with invalid attributes presents without value', () => {
295- // const xmlData = encoder.encode(`<rootNode 123 abc='123' bc='567' />`);
296- // const expected = {
297- // err: {
298- // code: 'InvalidAttr',
299- // // "msg": "attribute 123 is an invalid name."
300- // msg: "boolean attribute '123' is not allowed.",
301- // line: 1,
302- // },
303- // };
304- // const result = validator.validate(xmlData);
305- // //console.log(JSON.stringify(result,null,4));
306- // expect(result).toStrictEqual(expected);
307- // });
308-
309- // it('should validate xml with attributeshaving openquote in value', () => {
310- // const xmlData = encoder.encode('<rootNode 123 abc=\'1"23\' bc="56\'7" />');
311- // const expected = {
312- // err: {
313- // code: 'InvalidAttr',
314- // // "msg": "attribute 123 is an invalid name."
315- // msg: "boolean attribute '123' is not allowed.",
316- // line: 1,
317- // },
318- // };
319- // const result = validator.validate(xmlData);
320- // //console.log(JSON.stringify(result,null,4));
321- // expect(result).toStrictEqual(expected);
322- //});
323153} ) ;
0 commit comments