@@ -61,29 +61,29 @@ describe('ConnectionPool', () => {
61
61
const recordA = request ( { url : 'https://example.com' } ) ;
62
62
const pool = new ConnectionPool ( [ recordA ] , simulationOptions ( { rtt, throughput} ) ) ;
63
63
const connection = pool . connectionsByOrigin . get ( 'https://example.com' ) [ 0 ] ;
64
- assert . ok ( connection . ssl , 'should have set connection TLS' ) ;
64
+ assert . isOk ( connection . ssl , 'should have set connection TLS' ) ;
65
65
} ) ;
66
66
67
67
it ( 'should set H2 properly' , ( ) => {
68
68
const recordA = request ( { protocol : 'h2' } ) ;
69
69
const pool = new ConnectionPool ( [ recordA ] , simulationOptions ( { rtt, throughput} ) ) ;
70
70
const connection = pool . connectionsByOrigin . get ( 'http://example.com' ) [ 0 ] ;
71
- assert . ok ( connection . isH2 ( ) , 'should have set HTTP/2' ) ;
71
+ assert . isOk ( connection . isH2 ( ) , 'should have set HTTP/2' ) ;
72
72
assert . lengthOf ( pool . connectionsByOrigin . get ( 'http://example.com' ) , 1 ) ;
73
73
} ) ;
74
74
75
75
it ( 'should set origin-specific RTT properly' , ( ) => {
76
76
const additionalRttByOrigin = new Map ( [ [ 'http://example.com' , 63 ] ] ) ;
77
77
const pool = new ConnectionPool ( [ request ( ) ] , simulationOptions ( { rtt, throughput, additionalRttByOrigin} ) ) ;
78
78
const connection = pool . connectionsByOrigin . get ( 'http://example.com' ) [ 0 ] ;
79
- assert . ok ( connection . rtt , rtt + 63 ) ;
79
+ assert . isOk ( connection . rtt , rtt + 63 ) ;
80
80
} ) ;
81
81
82
82
it ( 'should set origin-specific server latency properly' , ( ) => {
83
83
const serverResponseTimeByOrigin = new Map ( [ [ 'http://example.com' , 63 ] ] ) ;
84
84
const pool = new ConnectionPool ( [ request ( ) ] , simulationOptions ( { rtt, throughput, serverResponseTimeByOrigin} ) ) ;
85
85
const connection = pool . connectionsByOrigin . get ( 'http://example.com' ) [ 0 ] ;
86
- assert . ok ( connection . serverLatency , 63 ) ;
86
+ assert . isOk ( connection . serverLatency , 63 ) ;
87
87
} ) ;
88
88
} ) ;
89
89
@@ -106,17 +106,17 @@ describe('ConnectionPool', () => {
106
106
it ( 'should allocate at least 6 connections' , ( ) => {
107
107
const pool = new ConnectionPool ( [ request ( ) ] , simulationOptions ( { rtt, throughput} ) ) ;
108
108
for ( let i = 0 ; i < 6 ; i ++ ) {
109
- assert . ok ( pool . acquire ( request ( ) ) , `did not find connection for ${ i } th request` ) ;
109
+ assert . isOk ( pool . acquire ( request ( ) ) , `did not find connection for ${ i } th request` ) ;
110
110
}
111
111
} ) ;
112
112
113
113
it ( 'should allocate all connections' , ( ) => {
114
114
const records = new Array ( 7 ) . fill ( undefined , 0 , 7 ) . map ( ( ) => request ( ) ) ;
115
115
const pool = new ConnectionPool ( records , simulationOptions ( { rtt, throughput} ) ) ;
116
116
const connections = records . map ( request => pool . acquire ( request ) ) ;
117
- assert . ok ( connections [ 0 ] , 'did not find connection for 1st request' ) ;
118
- assert . ok ( connections [ 5 ] , 'did not find connection for 6th request' ) ;
119
- assert . ok ( connections [ 6 ] , 'did not find connection for 7th request' ) ;
117
+ assert . isOk ( connections [ 0 ] , 'did not find connection for 1st request' ) ;
118
+ assert . isOk ( connections [ 5 ] , 'did not find connection for 6th request' ) ;
119
+ assert . isOk ( connections [ 6 ] , 'did not find connection for 7th request' ) ;
120
120
} ) ;
121
121
122
122
it ( 'should be oblivious to connection reuse' , ( ) => {
@@ -125,16 +125,16 @@ describe('ConnectionPool', () => {
125
125
const pool = new ConnectionPool ( [ coldRecord , warmRecord ] , simulationOptions ( { rtt, throughput} ) ) ;
126
126
pool . connectionReusedByRequestId . set ( warmRecord . requestId , true ) ;
127
127
128
- assert . ok ( pool . acquire ( coldRecord ) , 'should have acquired connection' ) ;
129
- assert . ok ( pool . acquire ( warmRecord ) , 'should have acquired connection' ) ;
128
+ assert . isOk ( pool . acquire ( coldRecord ) , 'should have acquired connection' ) ;
129
+ assert . isOk ( pool . acquire ( warmRecord ) , 'should have acquired connection' ) ;
130
130
pool . release ( coldRecord ) ;
131
131
132
132
for ( const connection of pool . connectionsByOrigin . get ( 'http://example.com' ) ) {
133
133
connection . setWarmed ( true ) ;
134
134
}
135
135
136
- assert . ok ( pool . acquire ( coldRecord ) , 'should have acquired connection' ) ;
137
- assert . ok ( pool . acquireActiveConnectionFromRequest ( warmRecord ) , 'should have acquired connection' ) ;
136
+ assert . isOk ( pool . acquire ( coldRecord ) , 'should have acquired connection' ) ;
137
+ assert . isOk ( pool . acquireActiveConnectionFromRequest ( warmRecord ) , 'should have acquired connection' ) ;
138
138
} ) ;
139
139
140
140
it ( 'should acquire in order of warmness' , ( ) => {
@@ -175,13 +175,13 @@ describe('ConnectionPool', () => {
175
175
requests . forEach ( request => pool . acquire ( request ) ) ;
176
176
177
177
assert . lengthOf ( pool . connectionsInUse ( ) , 6 ) ;
178
- assert . ok ( ! pool . acquire ( requests [ 6 ] ) , 'had connection that is in use' ) ;
178
+ assert . isOk ( ! pool . acquire ( requests [ 6 ] ) , 'had connection that is in use' ) ;
179
179
180
180
pool . release ( requests [ 0 ] ) ;
181
181
assert . lengthOf ( pool . connectionsInUse ( ) , 5 ) ;
182
182
183
- assert . ok ( pool . acquire ( requests [ 6 ] ) , 'could not reissue released connection' ) ;
184
- assert . ok ( ! pool . acquire ( requests [ 0 ] ) , 'had connection that is in use' ) ;
183
+ assert . isOk ( pool . acquire ( requests [ 6 ] ) , 'could not reissue released connection' ) ;
184
+ assert . isOk ( ! pool . acquire ( requests [ 0 ] ) , 'had connection that is in use' ) ;
185
185
} ) ;
186
186
} ) ;
187
187
} ) ;
0 commit comments