test/connection: catch server exceptions

This commit is contained in:
Zack Schuster 2022-05-06 03:15:34 -07:00
parent dace0f0a6b
commit f6bd3bb6a0
1 changed files with 2 additions and 2 deletions

View File

@ -10,8 +10,8 @@ let counter = 0;
function testConnection(options: Partial<SMTPConnectionOptions> = {}) {
const increment = counter++;
return new Promise<void>((resolve, reject) => {
const { ssl } = options;
const server = new SMTPServer(ssl ? { secure: true } : undefined);
const server = new SMTPServer({ secure: options.ssl as boolean });
server.on('error', (err) => reject(err));
server.listen(port + increment, () => {
const connection = new SMTPConnection(options);
connection.connect((err) => {