@@ -636,18 +636,19 @@ describe('app.router', function(){
636
636
637
637
it ( 'should work cross-segment' , function ( done ) {
638
638
var app = express ( ) ;
639
+ var cb = after ( 2 , done )
639
640
640
641
app . get ( '/api*' , function ( req , res ) {
641
642
res . send ( req . params [ 0 ] ) ;
642
643
} ) ;
643
644
644
645
request ( app )
645
- . get ( '/api' )
646
- . expect ( '' , function ( ) {
647
- request ( app )
646
+ . get ( '/api' )
647
+ . expect ( 200 , '' , cb )
648
+
649
+ request ( app )
648
650
. get ( '/api/hey' )
649
- . expect ( '/hey' , done ) ;
650
- } ) ;
651
+ . expect ( 200 , '/hey' , cb )
651
652
} )
652
653
653
654
it ( 'should allow naming' , function ( done ) {
@@ -863,36 +864,38 @@ describe('app.router', function(){
863
864
describe ( '.:name' , function ( ) {
864
865
it ( 'should denote a format' , function ( done ) {
865
866
var app = express ( ) ;
867
+ var cb = after ( 2 , done )
866
868
867
869
app . get ( '/:name.:format' , function ( req , res ) {
868
870
res . end ( req . params . name + ' as ' + req . params . format ) ;
869
871
} ) ;
870
872
871
873
request ( app )
872
- . get ( '/foo.json' )
873
- . expect ( 'foo as json' , function ( ) {
874
- request ( app )
874
+ . get ( '/foo.json' )
875
+ . expect ( 200 , 'foo as json' , cb )
876
+
877
+ request ( app )
875
878
. get ( '/foo' )
876
- . expect ( 404 , done ) ;
877
- } ) ;
879
+ . expect ( 404 , cb )
878
880
} )
879
881
} )
880
882
881
883
describe ( '.:name?' , function ( ) {
882
884
it ( 'should denote an optional format' , function ( done ) {
883
885
var app = express ( ) ;
886
+ var cb = after ( 2 , done )
884
887
885
888
app . get ( '/:name.:format?' , function ( req , res ) {
886
889
res . end ( req . params . name + ' as ' + ( req . params . format || 'html' ) ) ;
887
890
} ) ;
888
891
889
892
request ( app )
890
- . get ( '/foo' )
891
- . expect ( 'foo as html' , function ( ) {
892
- request ( app )
893
+ . get ( '/foo' )
894
+ . expect ( 200 , 'foo as html' , cb )
895
+
896
+ request ( app )
893
897
. get ( '/foo.json' )
894
- . expect ( 'foo as json' , done ) ;
895
- } ) ;
898
+ . expect ( 200 , 'foo as json' , done )
896
899
} )
897
900
} )
898
901
0 commit comments