@@ -8,6 +8,7 @@ import * as events from '@/events';
8
8
import * as utils from '@/utils' ;
9
9
import * as testsUtils from './utils' ;
10
10
import * as tls from 'tls' ;
11
+ import * as errors from '@/errors' ;
11
12
12
13
13
14
const certChain = `
@@ -178,9 +179,6 @@ describe(QUICClient.name, () => {
178
179
localHost : '::' as Host ,
179
180
crypto,
180
181
logger : logger . getChild ( QUICClient . name ) ,
181
- config : {
182
- logKeys : './tmp/keylog.log' ,
183
- }
184
182
} ) ;
185
183
const conn = ( await connectionEventP ) . detail ;
186
184
expect ( conn . localHost ) . toBe ( '127.0.0.1' ) ;
@@ -249,33 +247,22 @@ describe(QUICClient.name, () => {
249
247
} ) ;
250
248
251
249
252
- test ( '' , async ( ) => {
253
- // I want to test that if there's no server what happens
254
- // Does it keep "dialing"
255
- // until it times out? Idle connection timeo ut
256
- // or something else happens
257
- // Because then on server side we can hole punch back
258
-
259
- const client = await QUICClient . createQUICClient ( {
250
+ test ( 'connection should time out' , async ( ) => {
251
+ // QUICClient repeatedly dials until the connection times out
252
+ await expect ( QUICClient . createQUICClient ( {
260
253
host : '127.0.0.1' as Host ,
261
254
port : 55555 as Port ,
262
255
localHost : '127.0.0.1' as Host ,
263
256
crypto,
264
257
logger : logger . getChild ( QUICClient . name ) ,
265
258
config : {
266
- logKeys : './tmp/keylog.log' ,
267
- maxIdleTimeout : 5000 ,
259
+ maxIdleTimeout : 1000 ,
268
260
}
269
- } ) ;
270
-
271
- // Because it is never established
272
- // It's basically awaiting forever
273
-
261
+ } ) ) . rejects . toThrow ( errors . ErrorQUICConnectionTimeout ) ;
274
262
} ) ;
275
263
276
264
277
265
test ( 'dual stack to dual stack' , async ( ) => {
278
-
279
266
const {
280
267
p : clientErrorEventP ,
281
268
rejectP : rejectClientErrorEventP
@@ -372,13 +359,5 @@ describe(QUICClient.name, () => {
372
359
await expect ( Promise . race ( [ clientErrorEventP , Promise . resolve ( ) ] ) ) . resolves . toBe ( undefined ) ;
373
360
await expect ( Promise . race ( [ serverErrorEventP , Promise . resolve ( ) ] ) ) . resolves . toBe ( undefined ) ;
374
361
} ) ;
375
- // test.only('', async () => {
376
- //
377
- // // const p = Promise.reject(new Error('Not implemented'));
378
- // const { p, rejectP } = utils.promise();
379
- // rejectP(new Error('oh no'));
380
- //
381
- // await expect(Promise.race([p, Promise.resolve()])).resolves.toBe(undefined);
382
- // });
383
362
// We need to test shared socket later
384
363
} ) ;
0 commit comments