File tree 1 file changed +19
-0
lines changed
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -759,6 +759,25 @@ describe('request(app)', function () {
759
759
} ) ;
760
760
} ) ;
761
761
762
+ // this scenario should never happen after https://github.com/visionmedia/supertest/pull/767
763
+ // meant for test coverage for lib/test.js#287
764
+ // https://github.com/visionmedia/supertest/blob/e064b5ae71e1dfa3e1a74745fda527ac542e1878/lib/test.js#L287
765
+ it ( '_assertFunction should catch and return error' , function ( done ) {
766
+ const error = new Error ( 'failed' ) ;
767
+ const returnedError = get
768
+ // private api
769
+ . _assertFunction ( function ( res ) {
770
+ throw error ;
771
+ } ) ;
772
+ get
773
+ . end ( function ( ) {
774
+ returnedError . should . equal ( error ) ;
775
+ returnedError . message . should . equal ( 'failed' ) ;
776
+ shouldIncludeStackWithThisFile ( returnedError ) ;
777
+ done ( ) ;
778
+ } ) ;
779
+ } ) ;
780
+
762
781
it (
763
782
'ensures truthy non-errors returned from asserts are not promoted to errors' ,
764
783
function ( done ) {
You can’t perform that action at this time.
0 commit comments