@@ -34,16 +34,10 @@ describe('Health checks', () => {
34
34
const app = express ( ) ;
35
35
app . use ( '/hc' , new healthCheck . HealthCheckHandler ( ) . handle ) ;
36
36
37
- it ( 'should respond with OK' , ( ) => {
38
- return chai . request ( app )
39
- . get ( '/hc' )
40
- . then ( res => {
41
- res . should . have . status ( 200 ) ;
42
- res . text . should . be . eql ( 'Everything is awesome' ) ;
43
- } )
44
- . catch ( function ( err ) {
45
- throw err ;
46
- } ) ;
37
+ it ( 'should respond with OK' , async ( ) => {
38
+ const res = await chai . request ( app ) . get ( '/hc' ) ;
39
+ res . should . have . status ( 200 ) ;
40
+ res . text . should . be . eql ( 'Everything is awesome' ) ;
47
41
} ) ;
48
42
} ) ;
49
43
@@ -64,25 +58,15 @@ describe('Health checks on disk', () => {
64
58
mockfs . restore ( ) ;
65
59
} ) ;
66
60
67
- it ( 'should respond with 500 when file not found' , ( ) => {
68
- return chai . request ( app )
69
- . get ( '/hc' )
70
- . then ( res => res . should . have . status ( 500 ) )
71
- . catch ( function ( err ) {
72
- throw err ;
73
- } ) ;
61
+ it ( 'should respond with 500 when file not found' , async ( ) => {
62
+ const res = await chai . request ( app ) . get ( '/hc' ) ;
63
+ res . should . have . status ( 500 ) ;
74
64
} ) ;
75
65
76
66
77
- it ( 'should respond with OK and file contents when found' , ( ) => {
78
- return chai . request ( app )
79
- . get ( '/hc2' )
80
- . then ( res => {
81
- res . should . have . status ( 200 ) ;
82
- // Stupid chai http doesn't work with `send()` and promises it seems (!!)
83
- } )
84
- . catch ( function ( err ) {
85
- throw err ;
86
- } ) ;
67
+ it ( 'should respond with OK and file contents when found' , async ( ) => {
68
+ const res = await chai . request ( app ) . get ( '/hc2' ) ;
69
+ res . should . have . status ( 200 ) ;
70
+ res . text . should . be . eql ( 'Everything is fine' ) ;
87
71
} ) ;
88
72
} ) ;
0 commit comments