feat(core): Upgrade dependencies and enhance XML parsing and building

This commit is contained in:
2024-12-30 20:57:27 +01:00
parent 431d97c4b1
commit 3ca651bc9a
6 changed files with 7985 additions and 3981 deletions

View File

@ -2,11 +2,7 @@ import { expect, tap } from '@push.rocks/tapbundle';
import * as smartxml from '../ts/index.js';
let testSmartxml: smartxml.SmartXml;
let testXml = `
<hello>
<wow>nice</wow>
</hello>
`;
let testXml = '';
tap.test('should create an instance', async () => {
testSmartxml = new smartxml.SmartXml();
@ -22,13 +18,14 @@ tap.test('should create an xml string', async () => {
}
});
console.log(xmlResult);
testXml = xmlResult;
});
tap.test('should parse an yml file', async () => {
const jsObject = testSmartxml.parseXmlToObject(testXml);
console.log(jsObject);
// console.log(JSON.stringify(jsObject, null, 2));
expect(typeof jsObject).toEqual('object');
expect(jsObject).property('hello').property('wow').toEqual('nice');
expect(jsObject).arrayItem(1).property('hello').arrayItem(0).property('wow').arrayItem(0).property('#text').toEqual('test');
});