This commit is contained in:
2025-05-24 00:23:35 +00:00
parent 0907949f8a
commit cb52446f65
76 changed files with 1401 additions and 867 deletions

View File

@ -1,20 +1,19 @@
import { tap, expect } from '@git.zone/tstest/tapbundle';
import * as net from 'net';
import * as path from 'path';
import { startTestServer, stopTestServer } from '../../helpers/server.loader.js';
import type { SmtpServer } from '../../../ts/mail/delivery/smtpserver/index.js';
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
// Test configuration
const TEST_PORT = 2525;
const TEST_PORT = 30049;
const TEST_TIMEOUT = 15000;
let testServer: SmtpServer;
let testServer: ITestServer;
// Setup
tap.test('setup - start SMTP server', async () => {
testServer = await startTestServer();
testServer = await startTestServer({ port: TEST_PORT, hostname: 'localhost' });
expect(testServer).toBeTypeofObject();
expect(testServer).toBeDefined();
expect(testServer.port).toEqual(TEST_PORT);
});
@ -51,7 +50,7 @@ tap.test('Multiple Recipients - should accept multiple valid recipients', async
currentStep = 'rcpt_to';
socket.write(`RCPT TO:<${recipients[recipientCount]}>\r\n`);
} else if (currentStep === 'rcpt_to') {
if (receivedData.includes('250 OK')) {
if (receivedData.includes('250')) {
acceptedRecipients++;
recipientCount++;
@ -469,8 +468,9 @@ tap.test('Multiple Recipients - should handle recipients from different domains'
// Teardown
tap.test('teardown - stop SMTP server', async () => {
if (testServer) {
await stopTestServer();
await stopTestServer(testServer);
}
expect(true).toEqual(true);
});
// Start the test