MCPcopy Create free account
hub / github.com/Stuk/jszip / testGenerate

Function testGenerate

test/asserts/generate.js:12–41  ·  view source on GitHub ↗
(assert, options)

Source from the content-addressed store, hash-verified

10}
11
12function testGenerate(assert, options) {
13 var done = assert.async();
14 var triggeredCallback = false;
15 new JSZip.external.Promise(function(resolve) {
16 resolve(options.prepare());
17 })
18 .then(function (zip) {
19 JSZipTestUtils.checkBasicStreamBehavior(assert, zip.generateInternalStream(options.options));
20 return zip;
21 })
22 .then(function(zip) {
23 var promise = zip.generateAsync(options.options);
24 zip.file("Hello.txt", "updating the zip file after the call won't change the result");
25 return promise;
26 })
27 .then(function(result) {
28 triggeredCallback = true;
29 options.assertions(null, result);
30
31 if (!options.skipReloadTest) {
32 JSZipTestUtils.checkGenerateStability(assert, result, options.options);
33 }
34 done();
35 }, function (err) {
36 triggeredCallback = true;
37 options.assertions(err, null);
38 done();
39 });
40 assert.ok(!triggeredCallback, "the async callback is async");
41}
42
43testGenerateFor([{
44 name : "no stream",

Callers 2

generate.jsFile · 0.85
testLazyDecompressionFunction · 0.85

Calls 4

asyncMethod · 0.80
generateAsyncMethod · 0.80
fileMethod · 0.80

Tested by

no test coverage detected