Skip to content

Commit

Permalink
test: Add test case for loading zip filenames which shadow method names
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelAquilina committed Jun 14, 2021
1 parent 2235749 commit d024c22
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/asserts/load.js
Expand Up @@ -17,6 +17,19 @@ QUnit.module("load", function () {
})['catch'](JSZipTestUtils.assertNoError);
});

JSZipTestUtils.testZipFile("Load files which shadow Object prototype methods", "ref/pollution.zip", function(assert, file) {
var done = assert.async();
assert.ok(typeof file === "string");
JSZip.loadAsync(file)
.then(function (zip) {
return zip.file("toString").async("string");
})
.then(function(result) {
assert.equal(result, "hello\n", "the zip was correctly read.");
done();
})['catch'](JSZipTestUtils.assertNoError);
});

JSZipTestUtils.testZipFile("load(string) handles bytes > 255", "ref/all.zip", function(assert, file) {
var done = assert.async();
// the method used to load zip with ajax will remove the extra bits.
Expand Down
Binary file added test/ref/pollution.zip
Binary file not shown.

0 comments on commit d024c22

Please sign in to comment.