Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(#767): 100% code coverage #795

Merged
merged 1 commit into from
Oct 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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