@@ -336,7 +336,7 @@ describe("action parameters", () => {
336
336
337
337
describe ( "@Param should give a param from route" , ( ) => {
338
338
assertRequest ( [ 3001 , 3002 ] , "get" , "users/1" , response => {
339
- paramUserId . should . be . equal ( 1 ) ;
339
+ expect ( paramUserId ) . to . be . equal ( 1 ) ;
340
340
expect ( response ) . to . be . status ( 200 ) ;
341
341
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
342
342
expect ( response . body ) . to . be . equal ( "<html><body>1</body></html>" ) ;
@@ -345,8 +345,8 @@ describe("action parameters", () => {
345
345
346
346
describe ( "multiple @Param should give a proper values from route" , ( ) => {
347
347
assertRequest ( [ 3001 , 3002 ] , "get" , "users/23/photos/32" , response => {
348
- paramFirstId . should . be . equal ( 23 ) ;
349
- paramSecondId . should . be . equal ( 32 ) ;
348
+ expect ( paramFirstId ) . to . be . equal ( 23 ) ;
349
+ expect ( paramSecondId ) . to . be . equal ( 32 ) ;
350
350
expect ( response ) . to . be . status ( 200 ) ;
351
351
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
352
352
expect ( response . body ) . to . be . equal ( "<html><body>23,32</body></html>" ) ;
@@ -411,18 +411,18 @@ describe("action parameters", () => {
411
411
412
412
describe ( "@QueryParam should give a proper values from request query parameters" , ( ) => {
413
413
assertRequest ( [ 3001 , 3002 ] , "get" , "photos?sortBy=name&count=2&limit=10&showAll=true" , response => {
414
- queryParamSortBy . should . be . equal ( "name" ) ;
415
- queryParamCount . should . be . equal ( "2" ) ;
416
- queryParamLimit . should . be . equal ( 10 ) ;
417
- queryParamShowAll . should . be . equal ( true ) ;
414
+ expect ( queryParamSortBy ) . to . be . equal ( "name" ) ;
415
+ expect ( queryParamCount ) . to . be . equal ( "2" ) ;
416
+ expect ( queryParamLimit ) . to . be . equal ( 10 ) ;
417
+ expect ( queryParamShowAll ) . to . be . equal ( true ) ;
418
418
expect ( response ) . to . be . status ( 200 ) ;
419
419
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
420
420
} ) ;
421
421
} ) ;
422
422
423
423
describe ( "for @QueryParam when required is params must be provided and they should not be empty" , ( ) => {
424
424
assertRequest ( [ 3001 , 3002 ] , "get" , "photos-with-required/?limit=0" , response => {
425
- queryParamLimit . should . be . equal ( 0 ) ;
425
+ expect ( queryParamLimit ) . to . be . equal ( 0 ) ;
426
426
expect ( response ) . to . be . status ( 200 ) ;
427
427
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
428
428
expect ( response . body ) . to . be . equal ( "<html><body>0</body></html>" ) ;
@@ -452,7 +452,7 @@ describe("action parameters", () => {
452
452
453
453
describe ( "for @QueryParam when parseJson flag is used query param must be converted to object" , ( ) => {
454
454
assertRequest ( [ 3001 , 3002 ] , "get" , "photos-with-json/?filter={\"keyword\": \"name\", \"limit\": 5}" , response => {
455
- queryParamFilter . should . be . eql ( { keyword : "name" , limit : 5 } ) ;
455
+ expect ( queryParamFilter ) . to . be . eql ( { keyword : "name" , limit : 5 } ) ;
456
456
expect ( response ) . to . be . status ( 200 ) ;
457
457
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
458
458
} ) ;
@@ -467,9 +467,9 @@ describe("action parameters", () => {
467
467
}
468
468
} ;
469
469
assertRequest ( [ 3001 , 3002 ] , "get" , "posts" , requestOptions , response => {
470
- headerParamToken . should . be . equal ( "31ds31das231sad12" ) ;
471
- headerParamCount . should . be . equal ( 20 ) ;
472
- headerParamShowAll . should . be . equal ( false ) ;
470
+ expect ( headerParamToken ) . to . be . equal ( "31ds31das231sad12" ) ;
471
+ expect ( headerParamCount ) . to . be . equal ( 20 ) ;
472
+ expect ( headerParamShowAll ) . to . be . equal ( false ) ;
473
473
expect ( response ) . to . be . status ( 200 ) ;
474
474
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
475
475
} ) ;
@@ -487,7 +487,7 @@ describe("action parameters", () => {
487
487
}
488
488
} ;
489
489
assertRequest ( [ 3001 , 3002 ] , "get" , "posts-with-required" , validRequestOptions , response => {
490
- headerParamLimit . should . be . equal ( 0 ) ;
490
+ expect ( headerParamLimit ) . to . be . equal ( 0 ) ;
491
491
expect ( response ) . to . be . status ( 200 ) ;
492
492
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
493
493
} ) ;
@@ -506,7 +506,7 @@ describe("action parameters", () => {
506
506
}
507
507
} ;
508
508
assertRequest ( [ 3001 , 3002 ] , "get" , "posts-with-json" , requestOptions , response => {
509
- headerParamFilter . should . be . eql ( { keyword : "name" , limit : 5 } ) ;
509
+ expect ( headerParamFilter ) . to . be . eql ( { keyword : "name" , limit : 5 } ) ;
510
510
expect ( response ) . to . be . status ( 200 ) ;
511
511
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
512
512
} ) ;
@@ -524,9 +524,9 @@ describe("action parameters", () => {
524
524
jar : jar
525
525
} ;
526
526
assertRequest ( [ 3001 , 3002 ] , "get" , "questions" , requestOptions , response => {
527
- cookieParamToken . should . be . equal ( "31ds31das231sad12" ) ;
528
- cookieParamCount . should . be . equal ( 20 ) ;
529
- cookieParamShowAll . should . be . equal ( false ) ;
527
+ expect ( cookieParamToken ) . to . be . equal ( "31ds31das231sad12" ) ;
528
+ expect ( cookieParamCount ) . to . be . equal ( 20 ) ;
529
+ expect ( cookieParamShowAll ) . to . be . equal ( false ) ;
530
530
expect ( response ) . to . be . status ( 200 ) ;
531
531
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
532
532
} ) ;
@@ -542,7 +542,7 @@ describe("action parameters", () => {
542
542
const invalidRequestOptions = { jar : request . jar ( ) } ;
543
543
544
544
assertRequest ( [ 3001 , 3002 ] , "get" , "questions-with-required" , validRequestOptions , response => {
545
- cookieParamLimit . should . be . equal ( 20 ) ;
545
+ expect ( cookieParamLimit ) . to . be . equal ( 20 ) ;
546
546
expect ( response ) . to . be . status ( 200 ) ;
547
547
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
548
548
} ) ;
@@ -560,7 +560,7 @@ describe("action parameters", () => {
560
560
const requestOptions = { jar : jar } ;
561
561
562
562
assertRequest ( [ 3001 , 3002 ] , "get" , "questions-with-json" , requestOptions , response => {
563
- cookieParamFilter . should . be . eql ( { keyword : "name" , limit : 5 } ) ;
563
+ expect ( cookieParamFilter ) . to . be . eql ( { keyword : "name" , limit : 5 } ) ;
564
564
expect ( response ) . to . be . status ( 200 ) ;
565
565
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
566
566
} ) ;
@@ -576,7 +576,7 @@ describe("action parameters", () => {
576
576
577
577
// todo: koa @Body with text bug. uncomment after fix https://github.com/koajs/bodyparser/issues/52
578
578
assertRequest ( [ 3001 /*, 3002*/ ] , "post" , "questions" , "hello" , requestOptions , response => {
579
- body . should . be . equal ( "hello" ) ;
579
+ expect ( body ) . to . be . equal ( "hello" ) ;
580
580
expect ( response ) . to . be . status ( 200 ) ;
581
581
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
582
582
} ) ;
@@ -592,7 +592,7 @@ describe("action parameters", () => {
592
592
} ;
593
593
594
594
assertRequest ( [ 3001 /*, 3002*/ ] , "post" , "questions-with-required" , "0" , requestOptions , response => {
595
- body . should . be . equal ( "0" ) ;
595
+ expect ( body ) . to . be . equal ( "0" ) ;
596
596
expect ( response ) . to . be . status ( 200 ) ;
597
597
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
598
598
} ) ;
@@ -608,7 +608,7 @@ describe("action parameters", () => {
608
608
609
609
describe ( "@Body should provide a json object for json-typed controllers and actions" , ( ) => {
610
610
assertRequest ( [ 3001 , 3002 ] , "post" , "posts" , { hello : "world" } , response => {
611
- body . should . be . eql ( { hello : "world" } ) ;
611
+ expect ( body ) . to . be . eql ( { hello : "world" } ) ;
612
612
expect ( response ) . to . be . status ( 200 ) ;
613
613
expect ( response ) . to . have . header ( "content-type" , "application/json; charset=utf-8" ) ;
614
614
expect ( response . body ) . to . be . eql ( body ) ; // should we allow to return a text body for json controllers?
@@ -626,9 +626,9 @@ describe("action parameters", () => {
626
626
627
627
describe ( "@BodyParam should provide a json object for json-typed controllers and actions" , ( ) => {
628
628
assertRequest ( [ 3001 , 3002 ] , "post" , "users" , { name : "johny" , age : 27 , isActive : true } , response => {
629
- bodyParamName . should . be . eql ( "johny" ) ;
630
- bodyParamAge . should . be . eql ( 27 ) ;
631
- bodyParamIsActive . should . be . eql ( true ) ;
629
+ expect ( bodyParamName ) . to . be . eql ( "johny" ) ;
630
+ expect ( bodyParamAge ) . to . be . eql ( 27 ) ;
631
+ expect ( bodyParamIsActive ) . to . be . eql ( true ) ;
632
632
expect ( response ) . to . be . status ( 204 ) ;
633
633
} ) ;
634
634
} ) ;
@@ -675,7 +675,7 @@ describe("action parameters", () => {
675
675
} ;
676
676
677
677
assertRequest ( [ 3001 , 3002 ] , "post" , "files" , undefined , requestOptions , response => {
678
- // uploadedFileName.should .be.eql("hello-world.txt");
678
+ // expect( uploadedFileName).to .be.eql("hello-world.txt");
679
679
expect ( response ) . to . be . status ( 200 ) ;
680
680
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
681
681
expect ( response . body ) . to . be . equal ( "<html><body>hello-world.txt</body></html>" ) ;
@@ -757,8 +757,8 @@ describe("action parameters", () => {
757
757
} ;
758
758
759
759
assertRequest ( [ 3001 , 3002 ] , "post" , "photos" , undefined , requestOptions , response => {
760
- uploadedFilesFirstName . should . be . eql ( "me.jpg" ) ;
761
- uploadedFilesSecondName . should . be . eql ( "she.jpg" ) ;
760
+ expect ( uploadedFilesFirstName ) . to . be . eql ( "me.jpg" ) ;
761
+ expect ( uploadedFilesSecondName ) . to . be . eql ( "she.jpg" ) ;
762
762
expect ( response ) . to . be . status ( 200 ) ;
763
763
expect ( response ) . to . have . header ( "content-type" , "text/html; charset=utf-8" ) ;
764
764
expect ( response . body ) . to . be . equal ( "<html><body>me.jpg she.jpg</body></html>" ) ;
0 commit comments