11/*global before,describe,it */
22var fs = require ( 'fs' ) ;
33var PassThrough = require ( 'readable-stream' ) . PassThrough ;
4+ var Readable = require ( 'readable-stream' ) . Readable ;
45var WriteStream = fs . createWriteStream ;
56
67var assert = require ( 'chai' ) . assert ;
@@ -113,13 +114,14 @@ describe('archiver', function() {
113114 archive
114115 . append ( testBuffer , { name : 'buffer.txt' , date : testDate } )
115116 . append ( fs . createReadStream ( 'test/fixtures/test.txt' ) , { name : 'stream.txt' , date : testDate } )
117+ . append ( Readable . from ( [ 'test' ] ) , { name : 'stream-like.txt' , date : testDate } )
116118 . append ( null , { name : 'directory/' , date : testDate } )
117119 . finalize ( ) ;
118120 } ) ;
119121
120122 it ( 'should append multiple entries' , function ( ) {
121123 assert . isArray ( actual ) ;
122- assert . lengthOf ( actual , 3 ) ;
124+ assert . lengthOf ( actual , 4 ) ;
123125 } ) ;
124126
125127 it ( 'should append buffer' , function ( ) {
@@ -142,6 +144,16 @@ describe('archiver', function() {
142144 assert . propertyVal ( entries [ 'stream.txt' ] , 'size' , 19 ) ;
143145 } ) ;
144146
147+ it ( 'should append stream-like source' , function ( ) {
148+ assert . property ( entries , 'stream-like.txt' ) ;
149+ assert . propertyVal ( entries [ 'stream-like.txt' ] , 'name' , 'stream-like.txt' ) ;
150+ assert . propertyVal ( entries [ 'stream-like.txt' ] , 'type' , 'file' ) ;
151+ assert . propertyVal ( entries [ 'stream-like.txt' ] , 'date' , '2013-01-03T14:26:38.000Z' ) ;
152+ assert . propertyVal ( entries [ 'stream-like.txt' ] , 'mode' , 420 ) ;
153+ assert . propertyVal ( entries [ 'stream-like.txt' ] , 'crc32' , 3632233996 ) ;
154+ assert . propertyVal ( entries [ 'stream-like.txt' ] , 'size' , 4 ) ;
155+ } ) ;
156+
145157 it ( 'should append directory' , function ( ) {
146158 assert . property ( entries , 'directory/' ) ;
147159 assert . propertyVal ( entries [ 'directory/' ] , 'name' , 'directory/' ) ;
0 commit comments