Skip to content

Commit

Permalink
test(#767): 100% code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
lamweili committed Oct 3, 2022
1 parent e064b5a commit 9c5bd92
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/supertest.js
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 9c5bd92

Please sign in to comment.