diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-07-03 19:19:21 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-07-03 19:20:00 +0100 |
| commit | 0b56dfce42c3944cce47e284608e6806f4c839c3 (patch) | |
| tree | 5f96f9c2908f1c5b00a7192e71d4c192abd7cf47 /tests/docx/content-types-reader.tests.js | |
| parent | 627c4a755395e313234bdb1914d168392006c483 (diff) | |
Move tests to test for easier Mocha usage
Diffstat (limited to 'tests/docx/content-types-reader.tests.js')
| -rw-r--r-- | tests/docx/content-types-reader.tests.js | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/tests/docx/content-types-reader.tests.js b/tests/docx/content-types-reader.tests.js deleted file mode 100644 index a223d09..0000000 --- a/tests/docx/content-types-reader.tests.js +++ /dev/null @@ -1,47 +0,0 @@ -var assert = require("assert"); - -var readContentTypesFromXml = require("../../lib/docx/content-types-reader").readContentTypesFromXml; -var XmlElement = require("../../lib/xml").Element; -var test = require("../testing").test; - - -describe('readContentTypesFromXml', function() { - test('reads default-per-extension from XML', function() { - var contentTypes = readContentTypesFromXml({ - root: 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({ - root: 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({ - root: 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({ - root: new XmlElement("content-types:Types", {}, []) - }); - assert.equal(contentTypes.findContentType("word/media/hat.PnG"), "image/png"); - }); -}); |
