Skip to content

Commit 14b710c

Browse files
committed
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 262e654 commit 14b710c

1 file changed

Lines changed: 14 additions & 34 deletions

File tree

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

Lines changed: 14 additions & 34 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', common.mustNotCall(() => {
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,7 @@ describe('TLS callback exception handling', () => {
307304
}
308305
}));
309306

310-
server.on('secureConnection', common.mustNotCall(() => {
311-
reject(new Error('secureConnection should not fire'));
312-
}));
307+
server.on('secureConnection', common.mustNotCall('secureConnection should not fire'));
313308

314309
await new Promise((res) => server.listen(0, res));
315310

@@ -324,7 +319,7 @@ describe('TLS callback exception handling', () => {
324319
}),
325320
});
326321

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

329324
await promise;
330325
});
@@ -354,10 +349,7 @@ describe('TLS callback exception handling', () => {
354349
reject(e);
355350
}
356351
}));
357-
358-
server.on('secureConnection', common.mustNotCall(() => {
359-
reject(new Error('secureConnection should not fire'));
360-
}));
352+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
361353

362354
await new Promise((res) => server.listen(0, res));
363355

@@ -368,7 +360,7 @@ describe('TLS callback exception handling', () => {
368360
ALPNProtocols: ['http/1.1', 'h2'],
369361
});
370362

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

373365
await promise;
374366
});
@@ -397,10 +389,8 @@ describe('TLS callback exception handling', () => {
397389
reject(e);
398390
}
399391
}));
392+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
400393

401-
server.on('secureConnection', common.mustNotCall(() => {
402-
reject(new Error('secureConnection should not fire'));
403-
}));
404394
await new Promise((res) => server.listen(0, res));
405395

406396
const client = tls.connect({
@@ -410,7 +400,7 @@ describe('TLS callback exception handling', () => {
410400
ALPNProtocols: ['http/1.1'],
411401
});
412402

413-
client.on('error', () => {});
403+
client.on('error', common.mustCall());
414404

415405
await promise;
416406
});
@@ -429,9 +419,7 @@ describe('TLS callback exception handling', () => {
429419

430420
const { promise, resolve, reject } = createTestPromise();
431421

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

436424
await new Promise((res) => server.listen(0, res));
437425

@@ -473,9 +461,7 @@ describe('TLS callback exception handling', () => {
473461

474462
const { promise, resolve, reject } = createTestPromise();
475463

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

480466
await new Promise((res) => server.listen(0, res));
481467

@@ -526,10 +512,7 @@ describe('TLS callback exception handling', () => {
526512
reject(e);
527513
}
528514
}));
529-
530-
server.on('secureConnection', () => {
531-
reject(new Error('secureConnection should not fire'));
532-
});
515+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
533516

534517
await new Promise((res) => server.listen(0, res));
535518

@@ -540,7 +523,7 @@ describe('TLS callback exception handling', () => {
540523
rejectUnauthorized: false,
541524
});
542525

543-
client.on('error', () => {});
526+
client.on('error', common.mustCall());
544527

545528
await promise;
546529
});
@@ -573,10 +556,7 @@ describe('TLS callback exception handling', () => {
573556
reject(e);
574557
}
575558
}));
576-
577-
server.on('secureConnection', () => {
578-
reject(new Error('secureConnection should not fire'));
579-
});
559+
server.on('secureConnection', common.mustNotCall('secureConnection listener'));
580560

581561
await new Promise((res) => server.listen(0, res));
582562

@@ -587,7 +567,7 @@ describe('TLS callback exception handling', () => {
587567
rejectUnauthorized: false,
588568
});
589569

590-
client.on('error', () => {});
570+
client.on('error', common.mustCall());
591571

592572
await promise;
593573
});

0 commit comments

Comments
 (0)