Skip to content

Commit

Permalink
Add empty file test for article generator
Browse files Browse the repository at this point in the history
  • Loading branch information
animetosho committed Oct 7, 2024
1 parent 830e17f commit cde5530
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,23 @@ it('basic (large) pooled post test', function(done) {
done();
});

it('empty file test', function(done) {
var a = new MultiEncoder('file', 0, 1);
assert.equal(a.parts, 1);
assert.equal(a.size, 0);
a.setHeaders({});
var a1 = a.generate(toBuffer(''));

assert.equal(a1.part, 1);
assert.equal(a1.inputLen, 0);
var postData = a1.data.toString();
assert.notEqual(postData.indexOf(' crc32=00000000'), -1);
assert.notEqual(postData.indexOf(' pcrc32=00000000'), -1);
assert.notEqual(postData.indexOf(' size=0 '), -1);

done();
});

it('should throw if sent too many parts', function(done) {
var a = new MultiEncoder('file', 6, 6);
a.setHeaders({});
Expand Down

0 comments on commit cde5530

Please sign in to comment.