Skip to content

Commit d024c22

Browse files
test: Add test case for loading zip filenames which shadow method names
1 parent 2235749 commit d024c22

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Diff for: test/asserts/load.js

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@ QUnit.module("load", function () {
1717
})['catch'](JSZipTestUtils.assertNoError);
1818
});
1919

20+
JSZipTestUtils.testZipFile("Load files which shadow Object prototype methods", "ref/pollution.zip", function(assert, file) {
21+
var done = assert.async();
22+
assert.ok(typeof file === "string");
23+
JSZip.loadAsync(file)
24+
.then(function (zip) {
25+
return zip.file("toString").async("string");
26+
})
27+
.then(function(result) {
28+
assert.equal(result, "hello\n", "the zip was correctly read.");
29+
done();
30+
})['catch'](JSZipTestUtils.assertNoError);
31+
});
32+
2033
JSZipTestUtils.testZipFile("load(string) handles bytes > 255", "ref/all.zip", function(assert, file) {
2134
var done = assert.async();
2235
// the method used to load zip with ajax will remove the extra bits.

Diff for: test/ref/pollution.zip

480 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)