update
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as net from 'net';
|
||||
import { startTestServer, stopTestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer } from '../../helpers/server.loader.js';
|
||||
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
|
||||
|
||||
const TEST_PORT = 2525;
|
||||
@ -71,7 +71,7 @@ tap.test('Abrupt Disconnection - should handle socket destruction without QUIT',
|
||||
setTimeout(() => resolve(false), 5000);
|
||||
});
|
||||
|
||||
expect(recoveryConnected).toBeTrue();
|
||||
expect(recoveryConnected).toEqual(true);
|
||||
|
||||
if (recoveryConnected) {
|
||||
// Get banner from recovery connection
|
||||
@ -143,7 +143,7 @@ tap.test('Abrupt Disconnection - should handle multiple simultaneous abrupt disc
|
||||
setTimeout(() => resolve(false), 5000);
|
||||
});
|
||||
|
||||
expect(stillAccepting).toBeTrue();
|
||||
expect(stillAccepting).toEqual(true);
|
||||
|
||||
if (stillAccepting) {
|
||||
const banner = await new Promise<string>((resolve) => {
|
||||
@ -240,7 +240,7 @@ tap.test('Abrupt Disconnection - should handle disconnection during DATA transfe
|
||||
setTimeout(() => resolve(false), 5000);
|
||||
});
|
||||
|
||||
expect(canConnect).toBeTrue();
|
||||
expect(canConnect).toEqual(true);
|
||||
|
||||
if (canConnect) {
|
||||
const banner = await new Promise<string>((resolve) => {
|
||||
@ -307,7 +307,7 @@ tap.test('Abrupt Disconnection - should timeout idle connections', async (tools)
|
||||
}
|
||||
|
||||
// Either behavior is acceptable
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
|
||||
} finally {
|
||||
done.resolve();
|
||||
@ -316,7 +316,7 @@ tap.test('Abrupt Disconnection - should timeout idle connections', async (tools)
|
||||
|
||||
tap.test('cleanup - stop SMTP server', async () => {
|
||||
await stopTestServer();
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as net from 'net';
|
||||
import { startTestServer, stopTestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer } from '../../helpers/server.loader.js';
|
||||
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
|
||||
|
||||
// Test configuration
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as net from 'net';
|
||||
import { startTestServer, stopTestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer } from '../../helpers/server.loader.js';
|
||||
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
|
||||
|
||||
const TEST_PORT = 2525;
|
||||
@ -62,7 +62,7 @@ tap.test('Connection Rejection - should handle suspicious domains', async (tools
|
||||
// We just verify it responds appropriately
|
||||
const validResponses = ['250', '421', '550', '501'];
|
||||
const hasValidResponse = validResponses.some(code => response.includes(code));
|
||||
expect(hasValidResponse).toBeTrue();
|
||||
expect(hasValidResponse).toEqual(true);
|
||||
|
||||
// Clean up
|
||||
if (!socket.destroyed) {
|
||||
@ -151,7 +151,7 @@ tap.test('Connection Rejection - should handle overload conditions', async (tool
|
||||
|
||||
// Either behavior is acceptable - rejection shows overload protection,
|
||||
// acceptance shows high capacity
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
|
||||
} finally {
|
||||
// Clean up all connections
|
||||
@ -225,7 +225,7 @@ tap.test('Connection Rejection - should reject invalid protocol', async (tools)
|
||||
const hasErrorResponse = errorResponses.some(code => response.includes(code));
|
||||
const closedWithoutResponse = response === 'CLOSED_WITHOUT_RESPONSE' || response === '';
|
||||
|
||||
expect(hasErrorResponse || closedWithoutResponse).toBeTrue();
|
||||
expect(hasErrorResponse || closedWithoutResponse).toEqual(true);
|
||||
|
||||
if (hasErrorResponse) {
|
||||
console.log('Server properly rejected with error response');
|
||||
@ -291,7 +291,7 @@ tap.test('Connection Rejection - should handle invalid commands gracefully', asy
|
||||
|
||||
tap.test('cleanup - stop SMTP server', async () => {
|
||||
await stopTestServer();
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
|
||||
tap.start();
|
@ -109,7 +109,7 @@ tap.test('CM-03: Active connection should not timeout', async () => {
|
||||
}
|
||||
|
||||
// Connection should still be active
|
||||
expect(isConnected).toBeTrue();
|
||||
expect(isConnected).toEqual(true);
|
||||
|
||||
// Close connection gracefully
|
||||
socket.write('QUIT\r\n');
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as net from 'net';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
|
||||
|
||||
const TEST_PORT = 2525;
|
||||
const TEST_TIMEOUT = 60000; // Longer timeout for keepalive tests
|
||||
@ -211,7 +211,7 @@ tap.test('Keepalive - should detect connection loss', async (tools) => {
|
||||
await new Promise(resolve => setTimeout(resolve, 10000));
|
||||
|
||||
// Connection should be detected as lost
|
||||
expect(connectionLost).toBeTrue();
|
||||
expect(connectionLost).toEqual(true);
|
||||
console.log('Keepalive detected connection loss');
|
||||
|
||||
} finally {
|
||||
|
@ -1,13 +1,15 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
|
||||
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
|
||||
import { createConcurrentConnections, performSmtpHandshake, closeSmtpConnection } from '../../helpers/test.utils.js';
|
||||
import { createConcurrentConnections, performSmtpHandshake, closeSmtpConnection } from '../../helpers/utils.js';
|
||||
|
||||
let testServer: SmtpServer;
|
||||
const CONCURRENT_COUNT = 10;
|
||||
|
||||
tap.test('setup - start SMTP server', async () => {
|
||||
testServer = await startTestServer();
|
||||
testServer = await startTestServer({
|
||||
port: 2526
|
||||
});
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
expect(testServer.port).toEqual(2526);
|
||||
@ -101,7 +103,7 @@ tap.test('CM-02: Connection limit enforcement - verify max connections', async (
|
||||
});
|
||||
|
||||
tap.test('cleanup - stop SMTP server', async () => {
|
||||
await stopTestServer();
|
||||
await stopTestServer(testServer);
|
||||
console.log('✅ Test server stopped');
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as net from 'net';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
|
||||
|
||||
const TEST_PORT = 2525;
|
||||
const TEST_TIMEOUT = 30000;
|
||||
@ -25,7 +25,7 @@ tap.test('Plain Connection - should establish basic TCP connection', async (tool
|
||||
setTimeout(() => resolve(false), 5000);
|
||||
});
|
||||
|
||||
expect(connected).toBeTrue();
|
||||
expect(connected).toEqual(true);
|
||||
|
||||
if (connected) {
|
||||
console.log('Plain connection established:');
|
||||
@ -279,7 +279,7 @@ tap.test('Plain Connection - should work on standard SMTP port 25', async (tools
|
||||
}
|
||||
|
||||
// Test passes regardless - port 25 connectivity is environment-dependent
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
|
||||
done.resolve();
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as net from 'net';
|
||||
import * as tls from 'tls';
|
||||
import * as path from 'path';
|
||||
import { startTestServer, stopTestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer } from '../../helpers/server.loader.js';
|
||||
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
|
||||
// Test configuration
|
||||
const TEST_PORT = 2525;
|
||||
@ -12,7 +12,10 @@ let testServer: SmtpServer;
|
||||
|
||||
// Setup
|
||||
tap.test('setup - start SMTP server with STARTTLS support', async () => {
|
||||
testServer = await startTestServer();
|
||||
testServer = await startTestServer({
|
||||
port: TEST_PORT,
|
||||
tlsEnabled: true // Enable TLS to advertise STARTTLS
|
||||
});
|
||||
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
@ -73,7 +76,7 @@ tap.test('STARTTLS - should upgrade plain connection to TLS', async (tools) => {
|
||||
tlsSocket!.write('QUIT\r\n');
|
||||
setTimeout(() => {
|
||||
tlsSocket!.destroy();
|
||||
expect(tlsSocket!.encrypted).toBeTrue();
|
||||
expect(tlsSocket!.encrypted).toEqual(true);
|
||||
done.resolve();
|
||||
}, 100);
|
||||
}
|
||||
@ -441,7 +444,7 @@ tap.test('STARTTLS - should use secure TLS version and ciphers', async (tools) =
|
||||
// Teardown
|
||||
tap.test('teardown - stop SMTP server', async () => {
|
||||
if (testServer) {
|
||||
await stopTestServer();
|
||||
await stopTestServer(testServer);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as net from 'net';
|
||||
import * as tls from 'tls';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
|
||||
|
||||
const TEST_PORT = 2525;
|
||||
const TEST_PORT_TLS = 30466;
|
||||
@ -61,7 +61,7 @@ tap.test('TLS Ciphers - should advertise STARTTLS for cipher negotiation', async
|
||||
socket.end();
|
||||
|
||||
// Either behavior is acceptable
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
|
||||
} finally {
|
||||
await stopTestServer();
|
||||
@ -106,7 +106,7 @@ tap.test('TLS Ciphers - should negotiate secure cipher suites', async (tools) =>
|
||||
console.log('Cipher security analysis:', cipherSecurity);
|
||||
|
||||
expect(cipher.name).toBeDefined();
|
||||
expect(cipherSecurity.secure).toBeTrue();
|
||||
expect(cipherSecurity.secure).toEqual(true);
|
||||
|
||||
// Send SMTP command to verify encrypted communication
|
||||
const banner = await new Promise<string>((resolve) => {
|
||||
@ -187,7 +187,7 @@ tap.test('TLS Ciphers - should reject weak cipher suites', async (tools) => {
|
||||
}
|
||||
|
||||
// Either behavior is logged - some servers may support legacy ciphers
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
|
||||
} finally {
|
||||
await stopTestServer();
|
||||
@ -249,7 +249,7 @@ tap.test('TLS Ciphers - should support forward secrecy', async (tools) => {
|
||||
socket.end();
|
||||
|
||||
// Forward secrecy is recommended but not required
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
|
||||
} finally {
|
||||
await stopTestServer();
|
||||
|
@ -1,12 +1,15 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
|
||||
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
|
||||
import { connectToSmtp, performSmtpHandshake, closeSmtpConnection } from '../../helpers/test.utils.js';
|
||||
import { connectToSmtp, performSmtpHandshake, closeSmtpConnection } from '../../helpers/utils.js';
|
||||
|
||||
let testServer: SmtpServer;
|
||||
|
||||
tap.test('setup - start SMTP server with TLS support', async () => {
|
||||
testServer = await startTestServer();
|
||||
testServer = await startTestServer({
|
||||
port: 2525,
|
||||
tlsEnabled: true // Enable TLS support
|
||||
});
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
expect(testServer.port).toEqual(2525);
|
||||
@ -26,7 +29,7 @@ tap.test('CM-01: TLS Connection Test - server should advertise STARTTLS capabili
|
||||
|
||||
// Check for STARTTLS support
|
||||
const supportsStarttls = capabilities.some(cap => cap.toUpperCase().includes('STARTTLS'));
|
||||
expect(supportsStarttls).toBeTrue();
|
||||
expect(supportsStarttls).toEqual(true);
|
||||
|
||||
// Close connection gracefully
|
||||
await closeSmtpConnection(socket);
|
||||
@ -44,7 +47,7 @@ tap.test('CM-01: TLS Connection Test - server should advertise STARTTLS capabili
|
||||
|
||||
tap.test('CM-01: TLS Connection Test - verify TLS certificate configuration', async () => {
|
||||
// This test verifies that the server has TLS certificates configured
|
||||
expect(testServer.config.tlsEnabled).toBeTrue();
|
||||
expect(testServer.config.tlsEnabled).toEqual(true);
|
||||
|
||||
// The server should have loaded certificates during startup
|
||||
// In production, this would validate actual certificate properties
|
||||
@ -52,7 +55,7 @@ tap.test('CM-01: TLS Connection Test - verify TLS certificate configuration', as
|
||||
});
|
||||
|
||||
tap.test('cleanup - stop SMTP server', async () => {
|
||||
await stopTestServer();
|
||||
await stopTestServer(testServer);
|
||||
console.log('✅ Test server stopped');
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as net from 'net';
|
||||
import * as tls from 'tls';
|
||||
import { startTestServer, stopTestServer } from '../server.loader.js';
|
||||
import { startTestServer, stopTestServer } from '../../helpers/server.loader.js';
|
||||
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
|
||||
const TEST_PORT = 2525;
|
||||
const TEST_PORT_TLS = 30465;
|
||||
@ -82,7 +82,7 @@ tap.test('TLS Versions - should support STARTTLS capability', async (tools) => {
|
||||
socket.end();
|
||||
|
||||
// STARTTLS is optional but common
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
|
||||
} finally {
|
||||
done.resolve();
|
||||
@ -105,7 +105,7 @@ tap.test('TLS Versions - should support modern TLS versions on secure port', asy
|
||||
|
||||
// At least one modern version should be supported
|
||||
const supportsModernTls = tls12Result.success || tls13Result.success;
|
||||
expect(supportsModernTls).toBeTrue();
|
||||
expect(supportsModernTls).toEqual(true);
|
||||
|
||||
if (tls12Result.success) {
|
||||
console.log('TLS 1.2 supported with cipher:', tls12Result.cipher);
|
||||
@ -137,7 +137,7 @@ tap.test('TLS Versions - should reject obsolete TLS versions', async (tools) =>
|
||||
console.log(`TLS 1.1 ${tls11Result.success ? 'accepted (legacy support)' : 'rejected (good)'}`);
|
||||
|
||||
// Either behavior is acceptable - log the results
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
|
||||
} finally {
|
||||
done.resolve();
|
||||
@ -261,7 +261,7 @@ async function testTlsVersion(version: string, port: number): Promise<{success:
|
||||
tap.test('cleanup - stop SMTP servers', async () => {
|
||||
await stopTestServer();
|
||||
await stopTestServer(testServerTls);
|
||||
expect(true).toBeTrue();
|
||||
expect(true).toEqual(true);
|
||||
});
|
||||
|
||||
tap.start();
|
||||
|
Reference in New Issue
Block a user