Skip to content

Commit 7c60148

Browse files
committed
fix: testcase
1 parent 9e2694e commit 7c60148

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎test/zip/uncompress_stream.test.js‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,16 @@ describe('test/zip/uncompress_stream.test.js', () => {
201201
});
202202

203203
uncompressStream.on('entry', (header, stream, next) => {
204-
stream.on('end', next);
205-
206204
if (header.type === 'file') {
207-
stream.pipe(fs.createWriteStream(path.join(destDir, header.name)));
205+
pipelinePromise(stream, fs.createWriteStream(path.join(destDir, header.name)))
206+
.then(next)
207+
.catch(done);
208208
} else { // directory
209209
fs.mkdir(path.join(destDir, header.name), { recursive: true }, err => {
210210
if (err) return done(err);
211211
stream.resume();
212212
});
213+
stream.on('end', next);
213214
}
214215
});
215216
});
@@ -231,15 +232,16 @@ describe('test/zip/uncompress_stream.test.js', () => {
231232
});
232233

233234
uncompressStream.on('entry', (header, stream, next) => {
234-
stream.on('end', next);
235-
236235
if (header.type === 'file') {
237-
stream.pipe(fs.createWriteStream(path.join(destDir, header.name)));
236+
pipelinePromise(stream, fs.createWriteStream(path.join(destDir, header.name)))
237+
.then(next)
238+
.catch(done);
238239
} else { // directory
239240
fs.mkdir(path.join(destDir, header.name), { recursive: true }, err => {
240241
if (err) return done(err);
241242
stream.resume();
242243
});
244+
stream.on('end', next);
243245
}
244246
});
245247
});

0 commit comments

Comments
 (0)