Skip to content

Commit

Permalink
Update test.js
Browse files Browse the repository at this point in the history
Added test for mimeType
  • Loading branch information
min1974 committed Jan 29, 2015
1 parent 357e718 commit 7b35405
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,27 @@ if (JSZip.support.blob) {
});
}

if (JSZip.support.blob) {
test("generate : type:blob mimeType:application/ods", function() {
var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
var blob = zip.generate({type:"blob", mimeType: "application/ods"});
ok(blob instanceof Blob, "The result is a instance of Blob");
equal(blob.type, "application/ods", "mime-type is application/ods");
});
} else {
test("generate : type:blob mimeType:application/ods", function() {
var zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
try {
var blob = zip.generate({type:"blob", mimeType: "application/ods"});
ok(false, "Blob is not supported, but no exception thrown");
} catch(e) {
ok(e.message.match("not supported by this browser"), "the error message is useful");
}
});
}

test("Filtering a zip", function() {
var zip = new JSZip();
zip.file("1.txt", "1\n");
Expand Down

0 comments on commit 7b35405

Please sign in to comment.