Skip to content

Commit

Permalink
Fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
parthverma1 committed Jun 24, 2024
1 parent 5b968b6 commit 8dfa17c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/collection/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ _.assign(Response.prototype, /** @lends Response.prototype */ {
this.body.toString().length;
}

if(!sizeInfo.downloadedBytes) {
if (!sizeInfo.downloadedBytes) {
sizeInfo.downloadedBytes = sizeInfo.body;
}

Expand Down
10 changes: 9 additions & 1 deletion test/unit/response.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,15 @@ describe('Response', function () {
var response = new Response();

expect(response.size()).to.eql({
body: 0, header: 32, total: 32
body: 0, header: 32, total: 32, downloadedBytes: 0
});
});

it('should report downloaded size correctly', function () {
var response = new Response({ body: 'random', downloadedBytes: 6 });

expect(response.size()).to.eql({
body: 6, header: 32, total: 38, downloadedBytes: 6
});
});
});
Expand Down

0 comments on commit 8dfa17c

Please sign in to comment.