From 9ff57bb770e0296bb2f5b7a41711c53954eb8c4e Mon Sep 17 00:00:00 2001
From: Michael Williamson
Date: Sun, 16 Aug 2015 14:21:25 +0100
Subject: Split xmlreader into nodes and reader modules
---
tests/xmlreader.tests.js | 88 ------------------------------------------------
1 file changed, 88 deletions(-)
delete mode 100644 tests/xmlreader.tests.js
(limited to 'tests/xmlreader.tests.js')
diff --git a/tests/xmlreader.tests.js b/tests/xmlreader.tests.js
deleted file mode 100644
index 842e300..0000000
--- a/tests/xmlreader.tests.js
+++ /dev/null
@@ -1,88 +0,0 @@
-var assert = require("assert");
-
-var xmlreader = require("../lib/xmlreader");
-var test = require("./testing").test;
-
-
-describe('xmlreader.read', function() {
- test('should read self-closing element', function() {
- return xmlreader.read("").then(function(result) {
- assert.deepEqual({type: "element", name: "body", attributes: {}, children: []}, result.root);
- });
- });
-
- test('should read empty element with separate closing tag', function() {
- return xmlreader.read("
").then(function(result) {
- assert.deepEqual({type: "element", name: "body", attributes: {}, children: []}, result.root);
- });
- });
-
- test('should read attributes of tags', function() {
- return xmlreader.read('Hello!').then(function(result) {
- assert.deepEqual({type: "text", value: "Hello!"}, result.root.children[0]);
- });
- });
-
- test('should read element with children', function() {
- return xmlreader.read("").then(function(result) {
- var root = result.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.read('').then(function(result) {
- assert.deepEqual(result.root.name, "{word}:body");
- });
- });
-
- test('mapped namespaces URIs are translated using map', function() {
- var namespaceMap = {
- "word": "x"
- };
-
- return xmlreader.read('', namespaceMap).then(function(result) {
- assert.deepEqual(result.root.name, "x:body");
- });
- });
-
- test('namespace of attributes is mapped to prefix', function() {
- var namespaceMap = {
- "word": "x"
- };
- var xmlString = '';
- return xmlreader.read(xmlString, namespaceMap).then(function(result) {
- assert.deepEqual(result.root.attributes["x:val"], "Hello!");
- });
- });
-
- test('can find first element with name', function() {
- return xmlreader.read('').then(function(result) {
- var first = result.root.first("b");
- assert.equal("1", first.attributes.index);
- });
- });
-
- test('whitespace between xml declaration and root tag is ignored', function() {
- return xmlreader.read('\n