@@ -11,7 +11,7 @@ describe("getStatus", () => {
11
11
dbVersion = ( await db . prepare ( "get" , "SELECT key, value FROM config where key = ?" , [ "version" ] ) ) . value ;
12
12
} ) ;
13
13
14
- it ( "Should be able to get status" , ( done ) => {
14
+ it ( "Should be able to get status" , ( ) =>
15
15
client . get ( endpoint )
16
16
. then ( res => {
17
17
assert . strictEqual ( res . status , 200 ) ;
@@ -22,106 +22,86 @@ describe("getStatus", () => {
22
22
assert . ok ( data . startTime ) ;
23
23
assert . ok ( data . processTime >= 0 ) ;
24
24
assert . ok ( data . loadavg . length == 2 ) ;
25
- done ( ) ;
26
25
} )
27
- . catch ( err => done ( err ) ) ;
28
- } ) ;
26
+ ) ;
29
27
30
- it ( "Should be able to get uptime only" , ( done ) => {
28
+ it ( "Should be able to get uptime only" , ( ) =>
31
29
client . get ( `${ endpoint } /uptime` )
32
30
. then ( res => {
33
31
assert . strictEqual ( res . status , 200 ) ;
34
32
assert . ok ( Number ( res . data ) >= 1 ) ; // uptime should be greater than 1s
35
- done ( ) ;
36
33
} )
37
- . catch ( err => done ( err ) ) ;
38
- } ) ;
34
+ ) ;
39
35
40
- it ( "Should be able to get commit only" , ( done ) => {
36
+ it ( "Should be able to get commit only" , ( ) =>
41
37
client . get ( `${ endpoint } /commit` )
42
38
. then ( res => {
43
39
assert . strictEqual ( res . status , 200 ) ;
44
40
assert . strictEqual ( res . data , "test" ) ; // commit should be test
45
- done ( ) ;
46
41
} )
47
- . catch ( err => done ( err ) ) ;
48
- } ) ;
42
+ ) ;
49
43
50
- it ( "Should be able to get db only" , ( done ) => {
44
+ it ( "Should be able to get db only" , ( ) =>
51
45
client . get ( `${ endpoint } /db` )
52
46
. then ( res => {
53
47
assert . strictEqual ( res . status , 200 ) ;
54
48
assert . strictEqual ( Number ( res . data ) , Number ( dbVersion ) ) ; // commit should be test
55
- done ( ) ;
56
49
} )
57
- . catch ( err => done ( err ) ) ;
58
- } ) ;
50
+ ) ;
59
51
60
- it ( "Should be able to get startTime only" , ( done ) => {
52
+ it ( "Should be able to get startTime only" , ( ) =>
61
53
client . get ( `${ endpoint } /startTime` )
62
54
. then ( res => {
63
55
assert . strictEqual ( res . status , 200 ) ;
64
56
const now = Date . now ( ) ;
65
57
assert . ok ( Number ( res . data ) <= now ) ; // startTime should be more than now
66
- done ( ) ;
67
58
} )
68
- . catch ( err => done ( err ) ) ;
69
- } ) ;
59
+ ) ;
70
60
71
- it ( "Should be able to get processTime only" , ( done ) => {
61
+ it ( "Should be able to get processTime only" , ( ) =>
72
62
client . get ( `${ endpoint } /processTime` )
73
63
. then ( res => {
74
64
assert . strictEqual ( res . status , 200 ) ;
75
65
assert . ok ( Number ( res . data ) >= 0 ) ;
76
- done ( ) ;
77
66
} )
78
- . catch ( err => done ( err ) ) ;
79
- } ) ;
67
+ ) ;
80
68
81
- it ( "Should be able to get loadavg only" , ( done ) => {
69
+ it ( "Should be able to get loadavg only" , ( ) =>
82
70
client . get ( `${ endpoint } /loadavg` )
83
71
. then ( res => {
84
72
assert . strictEqual ( res . status , 200 ) ;
85
73
assert . ok ( Number ( res . data [ 0 ] ) >= 0 ) ;
86
74
assert . ok ( Number ( res . data [ 1 ] ) >= 0 ) ;
87
- done ( ) ;
88
75
} )
89
- . catch ( err => done ( err ) ) ;
90
- } ) ;
76
+ ) ;
91
77
92
- it ( "Should be able to get statusRequests only" , function ( done ) {
78
+ it ( "Should be able to get statusRequests only" , function ( ) {
93
79
if ( ! config . redis ?. enabled ) this . skip ( ) ;
94
- client . get ( `${ endpoint } /statusRequests` )
80
+ return client . get ( `${ endpoint } /statusRequests` )
95
81
. then ( res => {
96
82
assert . strictEqual ( res . status , 200 ) ;
97
83
assert . ok ( Number ( res . data ) > 1 ) ;
98
- done ( ) ;
99
- } )
100
- . catch ( err => done ( err ) ) ;
84
+ } ) ;
101
85
} ) ;
102
86
103
- it ( "Should be able to get status with statusRequests" , function ( done ) {
87
+ it ( "Should be able to get status with statusRequests" , function ( ) {
104
88
if ( ! config . redis ?. enabled ) this . skip ( ) ;
105
- client . get ( endpoint )
89
+ return client . get ( endpoint )
106
90
. then ( res => {
107
91
assert . strictEqual ( res . status , 200 ) ;
108
92
const data = res . data ;
109
93
assert . ok ( data . statusRequests > 2 ) ;
110
- done ( ) ;
111
- } )
112
- . catch ( err => done ( err ) ) ;
94
+ } ) ;
113
95
} ) ;
114
96
115
- it ( "Should be able to get redis latency" , function ( done ) {
97
+ it ( "Should be able to get redis latency" , function ( ) {
116
98
if ( ! config . redis ?. enabled ) this . skip ( ) ;
117
- client . get ( endpoint )
99
+ return client . get ( endpoint )
118
100
. then ( res => {
119
101
assert . strictEqual ( res . status , 200 ) ;
120
102
const data = res . data ;
121
103
assert . ok ( data . redisProcessTime >= 0 ) ;
122
- done ( ) ;
123
- } )
124
- . catch ( err => done ( err ) ) ;
104
+ } ) ;
125
105
} ) ;
126
106
127
107
it ( "Should return commit unkown if not present" , ( done ) => {
0 commit comments