This commit is contained in:
2025-05-23 19:49:25 +00:00
parent e0f6e3237b
commit a7438a7cd6
40 changed files with 189 additions and 178 deletions

View File

@ -1,17 +1,18 @@
import { tap, expect } from '@git.zone/tapbundle';
import { tap, expect } from '@git.zone/tstest/tapbundle';
import * as net from 'net';
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
import { startTestServer, stopTestServer, type ITestServer } from '../server.loader.js';
const TEST_PORT = 30032;
const TEST_PORT = 2525;
const TEST_TIMEOUT = 30000;
tap.test('Plain Connection - should establish basic TCP connection', async (tools) => {
const done = tools.defer();
// Start test server
const testServer = await startTestServer({ port: TEST_PORT });
const testServer = await startTestServer();
try {
await new Promise(resolve => setTimeout(resolve, 1000));try {
const socket = net.createConnection({
host: 'localhost',
port: TEST_PORT,
@ -36,7 +37,7 @@ tap.test('Plain Connection - should establish basic TCP connection', async (tool
}
} finally {
await stopTestServer(testServer);
await stopTestServer();
done.resolve();
}
});
@ -45,9 +46,10 @@ tap.test('Plain Connection - should receive SMTP banner on plain connection', as
const done = tools.defer();
// Start test server
const testServer = await startTestServer({ port: TEST_PORT });
const testServer = await startTestServer();
try {
await new Promise(resolve => setTimeout(resolve, 1000));try {
const socket = net.createConnection({
host: 'localhost',
port: TEST_PORT,
@ -74,7 +76,7 @@ tap.test('Plain Connection - should receive SMTP banner on plain connection', as
socket.end();
} finally {
await stopTestServer(testServer);
await stopTestServer();
done.resolve();
}
});
@ -83,9 +85,10 @@ tap.test('Plain Connection - should complete full SMTP transaction on plain conn
const done = tools.defer();
// Start test server
const testServer = await startTestServer({ port: TEST_PORT });
const testServer = await startTestServer();
try {
await new Promise(resolve => setTimeout(resolve, 1000));try {
const socket = net.createConnection({
host: 'localhost',
port: TEST_PORT,
@ -176,7 +179,7 @@ tap.test('Plain Connection - should complete full SMTP transaction on plain conn
socket.end();
} finally {
await stopTestServer(testServer);
await stopTestServer();
done.resolve();
}
});
@ -185,9 +188,10 @@ tap.test('Plain Connection - should handle multiple plain connections', async (t
const done = tools.defer();
// Start test server
const testServer = await startTestServer({ port: TEST_PORT });
const testServer = await startTestServer();
try {
await new Promise(resolve => setTimeout(resolve, 1000));try {
const connectionCount = 3;
const connections: net.Socket[] = [];
@ -226,7 +230,7 @@ tap.test('Plain Connection - should handle multiple plain connections', async (t
}
} finally {
await stopTestServer(testServer);
await stopTestServer();
done.resolve();
}
});