Skip to content

Commit f671d64

Browse files
tegefaulkesCMCDragonkai
authored andcommitted
tests: added timeout test and removed debug configs
* Related #2 [ci skip]
1 parent 99a47eb commit f671d64

File tree

1 file changed

+6
-27
lines changed

1 file changed

+6
-27
lines changed

tests/QUICClient.test.ts

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import * as events from '@/events';
88
import * as utils from '@/utils';
99
import * as testsUtils from './utils';
1010
import * as tls from 'tls';
11+
import * as errors from '@/errors';
1112

1213

1314
const certChain = `
@@ -178,9 +179,6 @@ describe(QUICClient.name, () => {
178179
localHost: '::' as Host,
179180
crypto,
180181
logger: logger.getChild(QUICClient.name),
181-
config: {
182-
logKeys: './tmp/keylog.log',
183-
}
184182
});
185183
const conn = (await connectionEventP).detail;
186184
expect(conn.localHost).toBe('127.0.0.1');
@@ -249,33 +247,22 @@ describe(QUICClient.name, () => {
249247
});
250248

251249

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({
260253
host: '127.0.0.1' as Host,
261254
port: 55555 as Port,
262255
localHost: '127.0.0.1' as Host,
263256
crypto,
264257
logger: logger.getChild(QUICClient.name),
265258
config: {
266-
logKeys: './tmp/keylog.log',
267-
maxIdleTimeout: 5000,
259+
maxIdleTimeout: 1000,
268260
}
269-
});
270-
271-
// Because it is never established
272-
// It's basically awaiting forever
273-
261+
})).rejects.toThrow(errors.ErrorQUICConnectionTimeout);
274262
});
275263

276264

277265
test('dual stack to dual stack', async () => {
278-
279266
const {
280267
p: clientErrorEventP,
281268
rejectP: rejectClientErrorEventP
@@ -372,13 +359,5 @@ describe(QUICClient.name, () => {
372359
await expect(Promise.race([clientErrorEventP, Promise.resolve()])).resolves.toBe(undefined);
373360
await expect(Promise.race([serverErrorEventP, Promise.resolve()])).resolves.toBe(undefined);
374361
});
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-
// });
383362
// We need to test shared socket later
384363
});

0 commit comments

Comments
 (0)