Skip to content

Commit 7653c0d

Browse files
committed
fixing multipart bug + test
1 parent 09d67e7 commit 7653c0d

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

test/http.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,12 +374,24 @@ describe('HTTP APIs', function () {
374374
describe('POST (multipart)', function () {
375375
it('should create as many files as the ones passed in multipart', function (done) {
376376
server.post('/sampleContainer/')
377-
.attach('test1', __dirname + '/resources/hello.html')
378-
.attach('test2', __dirname + '/resources/hello.html')
377+
.attach('timbl', __dirname + '/resources/timbl.jpg')
378+
.attach('nicola', __dirname + '/resources/nicola.jpg')
379379
.expect(200)
380380
.end(function (err) {
381381
if (err) return done(err)
382-
done()
382+
383+
var sizeNicola = fs.statSync(__dirname + '/resources/nicola.jpg').size
384+
var sizeTim = fs.statSync(__dirname + '/resources/timbl.jpg').size
385+
var sizeNicolaLocal = fs.statSync(__dirname + '/resources/sampleContainer/nicola.jpg').size
386+
var sizeTimLocal = fs.statSync(__dirname + '/resources/sampleContainer/timbl.jpg').size
387+
388+
if (sizeNicola === sizeNicolaLocal && sizeTim === sizeTimLocal) {
389+
return done()
390+
} else {
391+
return done(new Error('Either the size (remote/local) don\'t match or files are not stored'))
392+
}
393+
rm('sampleContainer/nicola.jpg')
394+
rm('sampleContainer/timbl.jpg')
383395
})
384396
})
385397
})

test/resources/nicola.jpg

59.6 KB
Loading

test/resources/timbl.jpg

19.1 KB
Loading

0 commit comments

Comments
 (0)