aboutsummaryrefslogtreecommitdiff
path: root/test/docx/content-types-reader.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-07-07 22:17:34 +0100
committerMichael Williamson <mike@zwobble.org>2016-07-07 22:17:34 +0100
commita080fc59a3fca08bdc6e23a2eeae440f5c7047b3 (patch)
tree3d56033c294c617eb7de6b693750efb70a81dd4f /test/docx/content-types-reader.tests.js
parent28a0e40b645c051d91626ca90959e847b061c8da (diff)
Use exports for all tests
Diffstat (limited to 'test/docx/content-types-reader.tests.js')
-rw-r--r--test/docx/content-types-reader.tests.js78
1 files changed, 38 insertions, 40 deletions
diff --git a/test/docx/content-types-reader.tests.js b/test/docx/content-types-reader.tests.js
index 5ea93ec..0c83dd2 100644
--- a/test/docx/content-types-reader.tests.js
+++ b/test/docx/content-types-reader.tests.js
@@ -2,46 +2,44 @@ var assert = require("assert");
var readContentTypesFromXml = require("../../lib/docx/content-types-reader").readContentTypesFromXml;
var XmlElement = require("../../lib/xml").Element;
-var test = require("../testing").test;
+var test = require("../test")(module);
-describe('readContentTypesFromXml', function() {
- test('reads default-per-extension from XML', function() {
- var contentTypes = readContentTypesFromXml(
- new XmlElement("content-types:Types", {}, [
- new XmlElement("content-types:Default", {Extension: "png", ContentType: "image/png"})
- ])
- );
- assert.equal(contentTypes.findContentType("word/media/hat.png"), "image/png");
- });
-
- test('reads overrides in preference to defaults', function() {
- var contentTypes = readContentTypesFromXml(
- new XmlElement("content-types:Types", {}, [
- new XmlElement("content-types:Default", {Extension: "png", ContentType: "image/png"}),
- new XmlElement("content-types:Override", {PartName: "/word/media/hat.png", ContentType: "image/hat"})
- ])
- );
- assert.equal(contentTypes.findContentType("word/media/hat.png"), "image/hat");
- });
-
- test('fallback content types have common image types', function() {
- var contentTypes = readContentTypesFromXml(
- new XmlElement("content-types:Types", {}, [])
- );
- assert.equal(contentTypes.findContentType("word/media/hat.png"), "image/png");
- assert.equal(contentTypes.findContentType("word/media/hat.gif"), "image/gif");
- assert.equal(contentTypes.findContentType("word/media/hat.jpg"), "image/jpeg");
- assert.equal(contentTypes.findContentType("word/media/hat.jpeg"), "image/jpeg");
- assert.equal(contentTypes.findContentType("word/media/hat.bmp"), "image/bmp");
- assert.equal(contentTypes.findContentType("word/media/hat.tif"), "image/tiff");
- assert.equal(contentTypes.findContentType("word/media/hat.tiff"), "image/tiff");
- });
-
- test('fallback content types are case insensitive on extension', function() {
- var contentTypes = readContentTypesFromXml(
- new XmlElement("content-types:Types", {}, [])
- );
- assert.equal(contentTypes.findContentType("word/media/hat.PnG"), "image/png");
- });
+test('reads default-per-extension from XML', function() {
+ var contentTypes = readContentTypesFromXml(
+ new XmlElement("content-types:Types", {}, [
+ new XmlElement("content-types:Default", {Extension: "png", ContentType: "image/png"})
+ ])
+ );
+ assert.equal(contentTypes.findContentType("word/media/hat.png"), "image/png");
+});
+
+test('reads overrides in preference to defaults', function() {
+ var contentTypes = readContentTypesFromXml(
+ new XmlElement("content-types:Types", {}, [
+ new XmlElement("content-types:Default", {Extension: "png", ContentType: "image/png"}),
+ new XmlElement("content-types:Override", {PartName: "/word/media/hat.png", ContentType: "image/hat"})
+ ])
+ );
+ assert.equal(contentTypes.findContentType("word/media/hat.png"), "image/hat");
+});
+
+test('fallback content types have common image types', function() {
+ var contentTypes = readContentTypesFromXml(
+ new XmlElement("content-types:Types", {}, [])
+ );
+ assert.equal(contentTypes.findContentType("word/media/hat.png"), "image/png");
+ assert.equal(contentTypes.findContentType("word/media/hat.gif"), "image/gif");
+ assert.equal(contentTypes.findContentType("word/media/hat.jpg"), "image/jpeg");
+ assert.equal(contentTypes.findContentType("word/media/hat.jpeg"), "image/jpeg");
+ assert.equal(contentTypes.findContentType("word/media/hat.bmp"), "image/bmp");
+ assert.equal(contentTypes.findContentType("word/media/hat.tif"), "image/tiff");
+ assert.equal(contentTypes.findContentType("word/media/hat.tiff"), "image/tiff");
+});
+
+test('fallback content types are case insensitive on extension', function() {
+ var contentTypes = readContentTypesFromXml(
+ new XmlElement("content-types:Types", {}, [])
+ );
+ assert.equal(contentTypes.findContentType("word/media/hat.PnG"), "image/png");
});