(assert, options)
| 10 | } |
| 11 | |
| 12 | function 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 | |
| 43 | testGenerateFor([{ |
| 44 | name : "no stream", |
no test coverage detected