var assert = require("assert"); var xmlreader = require("../../lib/xml/reader"); var test = require("../test")(module); test('should read self-closing element', function() { return xmlreader.readString("
").then(function(result) { assert.deepEqual({type: "element", name: "body", attributes: {}, children: []}, result); }); }); test('should read attributes of tags', function() { return xmlreader.readString('Hello!').then(function(result) { assert.deepEqual({type: "text", value: "Hello!"}, result.children[0]); }); }); test('should read element with children', function() { return xmlreader.readString("").then(function(root) { assert.equal(2, root.children.length); assert.equal("a", root.children[0].name); assert.equal("b", root.children[1].name); }); }); test('unmapped namespaces URIs are included in braces as prefix', function() { return xmlreader.readString('