@@ -9,6 +9,8 @@ import { makeTemporaryToolkitFolder } from '../../../shared/filesystemUtilities'
99import path from 'path'
1010import fs from '../../../shared/fs/fs'
1111import crypto from 'crypto'
12+ // @ts -ignore
13+ import { BlobWriter } from '@zip.js/zip.js'
1214
1315describe ( 'zipStream' , function ( ) {
1416 let tmpDir : string
@@ -42,13 +44,19 @@ describe('zipStream', function () {
4244
4345 it ( 'should unzip from a buffer' , async function ( ) {
4446 const zipStream = new ZipStream ( )
45- await zipStream . writeString ( 'foo bar' , 'file.txt' , true )
47+ await zipStream . writeString ( 'foo bar foo ' , 'file.txt' , true )
4648 const result = await zipStream . finalize ( )
4749
4850 const zipBuffer = result . streamBuffer . getContents ( )
4951 assert . ok ( zipBuffer )
5052 const zipEntries = await ZipStream . unzip ( zipBuffer )
5153 assert . strictEqual ( zipEntries [ 0 ] . filename , 'file.txt' )
54+ assert . strictEqual ( zipEntries . length , 1 )
55+
56+ // Read data back from zip to verify
57+ const data = await zipEntries [ 0 ] . getData ! ( new BlobWriter ( 'text/plain' ) )
58+ const textData = await data . text ( )
59+ assert . strictEqual ( textData , 'foo bar foo' )
5260 } )
5361
5462 it ( 'should write contents to file' , async function ( ) {
0 commit comments