Skip to content

Commit 824bc66

Browse files
authored
test: copyedit test-tls-psk-alpn-callback-exception-handling
Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #63485 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent bf5c221 commit 824bc66

1 file changed

Lines changed: 13 additions & 35 deletions

File tree

‎test/parallel/test-tls-psk-alpn-callback-exception-handling.js‎

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,7 @@ describe('TLS callback exception handling', () => {
9595
reject(e);
9696
}
9797
}));
98-
99-
server.on('secureConnection', () => {
100-
reject(new Error('secureConnection should not fire'));
101-
});
98+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
10299

103100
await new Promise((res) => server.listen(0, res));
104101

@@ -113,7 +110,7 @@ describe('TLS callback exception handling', () => {
113110
}),
114111
});
115112

116-
client.on('error', () => {});
113+
client.on('error', common.mustCall());
117114

118115
await promise;
119116
});
@@ -307,9 +304,6 @@ describe('TLS callback exception handling', () => {
307304
}
308305
}));
309306

310-
server.on('secureConnection', () => {
311-
reject(new Error('secureConnection should not fire'));
312-
});
313307

314308
await new Promise((res) => server.listen(0, res));
315309

@@ -324,7 +318,7 @@ describe('TLS callback exception handling', () => {
324318
}),
325319
});
326320

327-
client.on('error', () => {});
321+
client.on('error', common.mustCall());
328322

329323
await promise;
330324
});
@@ -354,10 +348,7 @@ describe('TLS callback exception handling', () => {
354348
reject(e);
355349
}
356350
}));
357-
358-
server.on('secureConnection', () => {
359-
reject(new Error('secureConnection should not fire'));
360-
});
351+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
361352

362353
await new Promise((res) => server.listen(0, res));
363354

@@ -368,7 +359,7 @@ describe('TLS callback exception handling', () => {
368359
ALPNProtocols: ['http/1.1', 'h2'],
369360
});
370361

371-
client.on('error', () => {});
362+
client.on('error', common.mustCall());
372363

373364
await promise;
374365
});
@@ -397,10 +388,7 @@ describe('TLS callback exception handling', () => {
397388
reject(e);
398389
}
399390
}));
400-
401-
server.on('secureConnection', () => {
402-
reject(new Error('secureConnection should not fire'));
403-
});
391+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
404392

405393
await new Promise((res) => server.listen(0, res));
406394

@@ -411,7 +399,7 @@ describe('TLS callback exception handling', () => {
411399
ALPNProtocols: ['http/1.1'],
412400
});
413401

414-
client.on('error', () => {});
402+
client.on('error', common.mustCall());
415403

416404
await promise;
417405
});
@@ -430,9 +418,7 @@ describe('TLS callback exception handling', () => {
430418

431419
const { promise, resolve, reject } = createTestPromise();
432420

433-
server.on('secureConnection', () => {
434-
reject(new Error('secureConnection should not fire'));
435-
});
421+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
436422

437423
await new Promise((res) => server.listen(0, res));
438424

@@ -474,9 +460,7 @@ describe('TLS callback exception handling', () => {
474460

475461
const { promise, resolve, reject } = createTestPromise();
476462

477-
server.on('secureConnection', () => {
478-
reject(new Error('secureConnection should not fire'));
479-
});
463+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
480464

481465
await new Promise((res) => server.listen(0, res));
482466

@@ -527,10 +511,7 @@ describe('TLS callback exception handling', () => {
527511
reject(e);
528512
}
529513
}));
530-
531-
server.on('secureConnection', () => {
532-
reject(new Error('secureConnection should not fire'));
533-
});
514+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
534515

535516
await new Promise((res) => server.listen(0, res));
536517

@@ -541,7 +522,7 @@ describe('TLS callback exception handling', () => {
541522
rejectUnauthorized: false,
542523
});
543524

544-
client.on('error', () => {});
525+
client.on('error', common.mustCall());
545526

546527
await promise;
547528
});
@@ -574,10 +555,7 @@ describe('TLS callback exception handling', () => {
574555
reject(e);
575556
}
576557
}));
577-
578-
server.on('secureConnection', () => {
579-
reject(new Error('secureConnection should not fire'));
580-
});
558+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
581559

582560
await new Promise((res) => server.listen(0, res));
583561

@@ -588,7 +566,7 @@ describe('TLS callback exception handling', () => {
588566
rejectUnauthorized: false,
589567
});
590568

591-
client.on('error', () => {});
569+
client.on('error', common.mustCall());
592570

593571
await promise;
594572
});

0 commit comments

Comments
 (0)