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 /test/zipfile.tests.js | |
| parent | 627c4a755395e313234bdb1914d168392006c483 (diff) | |
Move tests to test for easier Mocha usage
Diffstat (limited to 'test/zipfile.tests.js')
| -rw-r--r-- | test/zipfile.tests.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/zipfile.tests.js b/test/zipfile.tests.js new file mode 100644 index 0000000..1a0ab99 --- /dev/null +++ b/test/zipfile.tests.js @@ -0,0 +1,26 @@ +var assert = require("assert"); + +var JSZip = require("jszip"); + +var test = require("./testing").test; +var zipfile = require("../lib/zipfile"); + +describe("zipfile", function() { + test('file in zip can be read after being written', function() { + var zip = emptyZipFile(); + assert(!zip.exists("song/title")); + + zip.write("song/title", "Dark Blue"); + + assert(zip.exists("song/title")); + return zip.read("song/title", "utf8").then(function(contents) { + assert.equal(contents, "Dark Blue"); + }); + }); +}); + +function emptyZipFile() { + var zip = new JSZip(); + var buffer = zip.generate({type: "arraybuffer"}); + return zipfile.openArrayBuffer(buffer); +} |
