@@ -96,7 +96,7 @@ describe "utils", ->
9696 done (new Error " #{ res .statusCode } : #{ res .headers [' x-cld-error' ]} " )
9797 res .on ' end' , ->
9898 file .on ' close' , ->
99- list = execSync (" unzip -l #{ filename} " )
99+ list = execSync (" unzip -l -qq #{ filename} " )
100100 list = list .toString ().split (' \n ' ).slice (3 , - 3 )
101101 list = (last (i .split (/ [ ] + / )) for i in list) # keep only filenames
102102 expect (list .length ).to .eql (2 )
@@ -149,18 +149,11 @@ describe "uploader", ->
149149 expect (archive_result).to .have .keys (expected_keys)
150150 describe ' .create_zip' , ->
151151 @ timeout helper .TIMEOUT_LONG
152- spy1 = undefined
153- spy2 = undefined
154- xhr = undefined
155- before ->
156- spy1 = sinon .spy cloudinary .uploader , " create_archive"
157- spy2 = sinon .spy ClientRequest .prototype , ' write'
158- xhr = sinon .useFakeXMLHttpRequest ()
159- after ->
160- spy1 .restore ()
161- spy2 .restore ()
162- xhr .restore ()
152+ mocked = helper .mockTest ()
163153 it ' should call create_archive with "zip" format and ignore missing resources' , ->
164154 uploader .create_zip ({tags : TEST_TAG, public_ids : [publicIdRaw, " non-existing-resource" ], resource_type : " raw" , allow_missing : true })
165- expect (spy1 .calledWith (null , {tags : TEST_TAG, public_ids : [publicIdRaw, " non-existing-resource" ], resource_type : " raw" , allow_missing : true }, " zip" )).to .be .ok ()
166- sinon .assert .calledWith (spy2, sinon .match ((arg )-> arg .toString ().match (/ name="allow_missing"\s * 1/ )))
155+ sinon .assert .calledWith mocked .write , sinon .match (helper .uploadParamMatcher (" tags[]" , TEST_TAG))
156+ sinon .assert .calledWith mocked .write , sinon .match (helper .uploadParamMatcher (" public_ids[]" , publicIdRaw))
157+ sinon .assert .calledWith mocked .write , sinon .match (helper .uploadParamMatcher (" public_ids[]" , " non-existing-resource" ))
158+ sinon .assert .calledWith mocked .write , sinon .match (helper .uploadParamMatcher (" allow_missing" , 1 ))
159+ sinon .assert .calledWith mocked .write , sinon .match (helper .uploadParamMatcher (" target_format" , " zip" ))
0 commit comments