update
This commit is contained in:
@ -3,16 +3,19 @@ import * as net from 'net';
|
||||
import { startTestServer, stopTestServer, type ITestServer } from '../../helpers/server.loader.js';
|
||||
|
||||
const TEST_PORT = 2525;
|
||||
|
||||
let testServer: ITestServer;
|
||||
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();
|
||||
testServer = await startTestServer({ port: TEST_PORT });
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));try {
|
||||
try {
|
||||
const socket = net.createConnection({
|
||||
host: 'localhost',
|
||||
port: TEST_PORT,
|
||||
@ -37,7 +40,7 @@ tap.test('Plain Connection - should establish basic TCP connection', async (tool
|
||||
}
|
||||
|
||||
} finally {
|
||||
await stopTestServer();
|
||||
await stopTestServer(testServer);
|
||||
done.resolve();
|
||||
}
|
||||
});
|
||||
@ -46,10 +49,11 @@ tap.test('Plain Connection - should receive SMTP banner on plain connection', as
|
||||
const done = tools.defer();
|
||||
|
||||
// Start test server
|
||||
const testServer = await startTestServer();
|
||||
testServer = await startTestServer({ port: TEST_PORT });
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));try {
|
||||
try {
|
||||
const socket = net.createConnection({
|
||||
host: 'localhost',
|
||||
port: TEST_PORT,
|
||||
@ -76,7 +80,7 @@ tap.test('Plain Connection - should receive SMTP banner on plain connection', as
|
||||
socket.end();
|
||||
|
||||
} finally {
|
||||
await stopTestServer();
|
||||
await stopTestServer(testServer);
|
||||
done.resolve();
|
||||
}
|
||||
});
|
||||
@ -85,10 +89,11 @@ tap.test('Plain Connection - should complete full SMTP transaction on plain conn
|
||||
const done = tools.defer();
|
||||
|
||||
// Start test server
|
||||
const testServer = await startTestServer();
|
||||
testServer = await startTestServer({ port: TEST_PORT });
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));try {
|
||||
try {
|
||||
const socket = net.createConnection({
|
||||
host: 'localhost',
|
||||
port: TEST_PORT,
|
||||
@ -179,7 +184,7 @@ tap.test('Plain Connection - should complete full SMTP transaction on plain conn
|
||||
socket.end();
|
||||
|
||||
} finally {
|
||||
await stopTestServer();
|
||||
await stopTestServer(testServer);
|
||||
done.resolve();
|
||||
}
|
||||
});
|
||||
@ -188,10 +193,11 @@ tap.test('Plain Connection - should handle multiple plain connections', async (t
|
||||
const done = tools.defer();
|
||||
|
||||
// Start test server
|
||||
const testServer = await startTestServer();
|
||||
testServer = await startTestServer({ port: TEST_PORT });
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));try {
|
||||
try {
|
||||
const connectionCount = 3;
|
||||
const connections: net.Socket[] = [];
|
||||
|
||||
@ -230,7 +236,7 @@ tap.test('Plain Connection - should handle multiple plain connections', async (t
|
||||
}
|
||||
|
||||
} finally {
|
||||
await stopTestServer();
|
||||
await stopTestServer(testServer);
|
||||
done.resolve();
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user