aboutsummaryrefslogtreecommitdiff
path: root/test/zipfile.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2021-08-27 19:42:39 +0100
committerMichael Williamson <mike@zwobble.org>2021-08-27 19:42:39 +0100
commitb6ab371b1f004a627f7390c442b6406d1f2be499 (patch)
tree046ea608e145bd7c27fb203d319a08f530375ead /test/zipfile.tests.js
parente0bb3d1cdac963f2c07ab782ad945d585a9babeb (diff)
Update JSZip to 3.2.0
Diffstat (limited to 'test/zipfile.tests.js')
-rw-r--r--test/zipfile.tests.js22
1 files changed, 12 insertions, 10 deletions
diff --git a/test/zipfile.tests.js b/test/zipfile.tests.js
index 5383c49..cf11804 100644
--- a/test/zipfile.tests.js
+++ b/test/zipfile.tests.js
@@ -6,21 +6,23 @@ var zipfile = require("../lib/zipfile");
var test = require("./test")(module);
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");
+ return emptyZipFile().then(function(zip) {
+ 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);
+ return zip.generateAsync({type: "arraybuffer"}).then(function(arrayBuffer) {
+ return zipfile.openArrayBuffer(arrayBuffer);
+ });
}