@@ -6,13 +6,13 @@ const http = require('http');
6
6
const initStats = require ( '.' ) ;
7
7
const { hrTimeToMs } = require ( './utils' ) ;
8
8
9
- test ( 'initMiddleware returns getStats and statsMiddleware' , t => {
9
+ test ( 'initMiddleware returns getStats and statsMiddleware' , ( t ) => {
10
10
const { getStats, statsMiddleware } = initStats ( ) ;
11
11
t . is ( typeof getStats , 'function' ) ;
12
12
t . is ( typeof statsMiddleware , 'function' ) ;
13
13
} ) ;
14
14
15
- test ( 'getStats returns a correct object' , t => {
15
+ test ( 'getStats returns a correct object' , ( t ) => {
16
16
const { getStats } = initStats ( ) ;
17
17
const stats = getStats ( ) ;
18
18
t . is ( typeof stats . uptime , 'number' ) ;
@@ -29,7 +29,7 @@ test('getStats returns a correct object', t => {
29
29
t . is ( typeof stats . customStats , 'undefined' ) ;
30
30
} ) ;
31
31
32
- test ( 'statsMiddleware works' , async t => {
32
+ test ( 'statsMiddleware works' , async ( t ) => {
33
33
const { getStats, statsMiddleware } = initStats ( ) ;
34
34
const server = createServer ( statsMiddleware ) ;
35
35
@@ -52,7 +52,7 @@ test('statsMiddleware works', async t => {
52
52
t . deepEqual ( stats . statusCodes , { 200 : 2 } ) ;
53
53
} ) ;
54
54
55
- test ( 'endpointStats option works' , async t => {
55
+ test ( 'endpointStats option works' , async ( t ) => {
56
56
const { getStats, statsMiddleware } = initStats ( { endpointStats : true } ) ;
57
57
const server = createServer ( statsMiddleware ) ;
58
58
@@ -78,10 +78,10 @@ test('endpointStats option works', async t => {
78
78
t . deepEqual ( endpointStat . statusCodes , { 200 : 1 } ) ;
79
79
} ) ;
80
80
81
- test ( 'complexEndpoints option works' , async t => {
81
+ test ( 'complexEndpoints option works' , async ( t ) => {
82
82
const { getStats, statsMiddleware } = initStats ( {
83
83
endpointStats : true ,
84
- complexEndpoints : [ '/user/:id' ]
84
+ complexEndpoints : [ '/user/:id' ] ,
85
85
} ) ;
86
86
const server = createServer ( statsMiddleware ) ;
87
87
@@ -99,7 +99,7 @@ test('complexEndpoints option works', async t => {
99
99
t . deepEqual ( endpointStat . statusCodes , { 200 : 2 } ) ;
100
100
} ) ;
101
101
102
- test ( 'customStats option works' , t => {
102
+ test ( 'customStats option works' , ( t ) => {
103
103
const { getStats, statsMiddleware } = initStats ( { customStats : true } ) ;
104
104
const req = { } ;
105
105
statsMiddleware ( req , { } , ( ) => { } ) ;
@@ -130,7 +130,7 @@ test('customStats option works', t => {
130
130
t . is ( customStat . count , 2 ) ;
131
131
} ) ;
132
132
133
- test ( 'addHeader option works' , async t => {
133
+ test ( 'addHeader option works' , async ( t ) => {
134
134
const { statsMiddleware } = initStats ( { addHeader : true } ) ;
135
135
const server = createServer ( statsMiddleware ) ;
136
136
@@ -139,7 +139,7 @@ test('addHeader option works', async t => {
139
139
t . assert ( res . headers [ 'x-response-time' ] . includes ( 'ms' ) ) ;
140
140
} ) ;
141
141
142
- test ( 'utils.hrTimeToMs works correctly' , t => {
142
+ test ( 'utils.hrTimeToMs works correctly' , ( t ) => {
143
143
t . is ( hrTimeToMs ( [ 0 , 0 ] ) , 0 ) ;
144
144
t . is ( hrTimeToMs ( [ 1 , 0 ] ) , 1000 ) ; // 1st argument is a second 1s = 1000ms
145
145
t . is ( hrTimeToMs ( [ 0 , 1 ] ) , 1e-6 ) ; // 2nd argument is a nanosecond 1ns = 1e-6ms
0 commit comments