Skip to content

Commit

Permalink
Merge pull request #795 from lamweili/code-coverage
Browse files Browse the repository at this point in the history
test(#767): 100% code coverage
  • Loading branch information
titanism authored Oct 4, 2022
2 parents fa129dc + 9c5bd92 commit a225e95
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/supertest.js
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,25 @@ describe('request(app)', function () {
});
});

// this scenario should never happen after https://github.com/visionmedia/supertest/pull/767
// meant for test coverage for lib/test.js#287
// https://github.com/visionmedia/supertest/blob/e064b5ae71e1dfa3e1a74745fda527ac542e1878/lib/test.js#L287
it('_assertFunction should catch and return error', function (done) {
const error = new Error('failed');
const returnedError = get
// private api
._assertFunction(function (res) {
throw error;
});
get
.end(function () {
returnedError.should.equal(error);
returnedError.message.should.equal('failed');
shouldIncludeStackWithThisFile(returnedError);
done();
});
});

it(
'ensures truthy non-errors returned from asserts are not promoted to errors',
function (done) {
Expand Down

0 comments on commit a225e95

Please sign in to comment.