feat(core): Upgrade dependencies and enhance XML parsing and building
This commit is contained in:
11
test/test.ts
11
test/test.ts
@ -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');
|
||||
});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user