Index: tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/entities/test/test.js |
diff --git a/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/entities/test/test.js b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/entities/test/test.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fa6c00df0ba28ac8ec7418bcb30d0fe21e3cc130 |
--- /dev/null |
+++ b/tools/vulcanize/node_modules/vulcanize/node_modules/cheerio/node_modules/entities/test/test.js |
@@ -0,0 +1,68 @@ |
+var assert = require("assert"); |
+var entities = require('../'); |
+ |
+describe("Encode->decode test", function() { |
+ var testcases = [ |
+ { |
+ input: "asdf & ÿ ü '", |
+ xml: "asdf & ÿ ü '", |
+ html4: "asdf & ÿ ü '", |
+ html5: "asdf & ÿ ü '" |
+ }, { |
+ input: "&", |
+ xml: "&", |
+ html4: "&", |
+ html5: "&" |
+ }, |
+ ]; |
+ testcases.forEach(function(tc) { |
+ var encodedXML = entities.encodeXML(tc.input); |
+ it("should XML encode " + tc.input, function() { |
+ assert.equal(encodedXML, tc.xml); |
+ }); |
+ it("should XML decode " + encodedXML, function() { |
+ assert.equal(entities.decodeXML(encodedXML), tc.input); |
+ }); |
+ var encodedHTML4 = entities.encodeHTML4(tc.input); |
+ it("should HTML4 encode " + tc.input, function() { |
+ assert.equal(encodedHTML4, tc.html4); |
+ }); |
+ it("should HTML4 decode " + encodedHTML4, function() { |
+ assert.equal(entities.decodeHTML4(encodedHTML4), tc.input); |
+ }); |
+ var encodedHTML5 = entities.encodeHTML5(tc.input); |
+ it("should HTML5 encode " + tc.input, function() { |
+ assert.equal(encodedHTML5, tc.html5); |
+ }); |
+ it("should HTML5 decode " + encodedHTML5, function() { |
+ assert.equal(entities.decodeHTML5(encodedHTML5), tc.input); |
+ }); |
+ }); |
+}); |
+ |
+describe("Decode test", function() { |
+ var testcases = [ |
+ { input: "&", output: "&" }, |
+ { input: "&", output: "&" }, |
+ { input: "&", output: "&" }, |
+ { input: "&", output: "&" }, |
+ { input: "&", output: "&" }, |
+ { input: "&", output: "&" }, |
+ { input: "&", output: "&" }, |
+ { input: ":", output: ":" }, |
+ { input: ":", output: ":" }, |
+ { input: ":", output: ":" }, |
+ { input: ":", output: ":" } |
+ ]; |
+ testcases.forEach(function(tc) { |
+ it("should XML decode " + tc.input, function() { |
+ assert.equal(entities.decodeXML(tc.input), tc.output); |
+ }); |
+ it("should HTML4 decode " + tc.input, function() { |
+ assert.equal(entities.decodeHTML4(tc.input), tc.output); |
+ }); |
+ it("should HTML5 decode " + tc.input, function() { |
+ assert.equal(entities.decodeHTML5(tc.input), tc.output); |
+ }); |
+ }); |
+}); |