This commit is contained in:
2025-05-23 21:20:39 +00:00
parent 9629329bc2
commit 0907949f8a
86 changed files with 654 additions and 569 deletions

View File

@ -2,7 +2,7 @@ import { tap, expect } from '@git.zone/tstest/tapbundle';
import * as plugins from '../plugins.js';
import * as net from 'net';
import * as tls from 'tls';
import { startTestServer, stopTestServer, TEST_PORT, sendEmailWithRawSocket } from '../server.loader.js';
import { startTestServer, stopTestServer, TEST_PORT, sendEmailWithRawSocket } from '../../helpers/server.loader.js';
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
let testServer: SmtpServer;
@ -78,7 +78,7 @@ tap.test('TLS Certificate Validation - STARTTLS certificate check', async (tools
const isValid = now >= validFrom && now <= validTo;
console.log('Certificate currently valid:', isValid);
expect(true).toBeTrue(); // Certificate present
expect(true).toEqual(true); // Certificate present
}
// Test EHLO over TLS
@ -91,7 +91,7 @@ tap.test('TLS Certificate Validation - STARTTLS certificate check', async (tools
if (response.includes('250')) {
console.log('EHLO over TLS successful');
expect(true).toBeTrue();
expect(true).toEqual(true);
tlsSocket.write('QUIT\r\n');
tlsSocket.end();
@ -133,7 +133,7 @@ tap.test('TLS Certificate Validation - Direct TLS connection', async (tools) =>
const cert = socket.getPeerCertificate();
if (cert && Object.keys(cert).length > 0) {
console.log('Certificate found on direct TLS connection');
expect(true).toBeTrue();
expect(true).toEqual(true);
}
socket.end();
@ -143,7 +143,7 @@ tap.test('TLS Certificate Validation - Direct TLS connection', async (tools) =>
socket.on('error', (err) => {
// Direct TLS might not be supported, try plain connection
console.log('Direct TLS not supported, this is expected for STARTTLS servers');
expect(true).toBeTrue();
expect(true).toEqual(true);
done.resolve();
});
@ -205,7 +205,7 @@ tap.test('TLS Certificate Validation - Certificate verification with strict mode
console.log('Authorization error:', tlsSocket.authorizationError);
}
expect(true).toBeTrue(); // Connection established
expect(true).toEqual(true); // Connection established
tlsSocket.write('QUIT\r\n');
tlsSocket.end();
done.resolve();
@ -213,7 +213,7 @@ tap.test('TLS Certificate Validation - Certificate verification with strict mode
tlsSocket.on('error', (err) => {
console.log('Certificate verification error (expected for self-signed):', err.message);
expect(true).toBeTrue(); // Error is expected for self-signed certificates
expect(true).toEqual(true); // Error is expected for self-signed certificates
socket.end();
done.resolve();
});