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

@ -1,7 +1,7 @@
import * as plugins from '@git.zone/tstest/tapbundle';
import { expect, tap } 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';
const TEST_PORT = 2525;
@ -299,7 +299,7 @@ tap.test('ERR-08: Error logging - Data transmission errors', async (tools) => {
(finalResponse.includes('250') ||
finalResponse.includes('5'));
expect(hasResponse).toBeTrue();
expect(hasResponse).toEqual(true);
socket.write('QUIT\r\n');
socket.end();

View File

@ -1,7 +1,7 @@
import * as plugins from '@git.zone/tstest/tapbundle';
import { expect, tap } 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';
const TEST_PORT = 2525;
@ -120,7 +120,7 @@ tap.test('ERR-07: Exception handling - Invalid commands', async (tools) => {
console.log('Server still responding:', serverStillResponding);
// Test passes if exceptions were handled OR server is still responding
expect(exceptionHandled || serverStillResponding).toBeTrue();
expect(exceptionHandled || serverStillResponding).toEqual(true);
if (socket.writable) {
socket.write('QUIT\r\n');

View File

@ -1,7 +1,7 @@
import * as plugins from '@git.zone/tstest/tapbundle';
import { expect, tap } 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';
const TEST_PORT = 2525;
@ -116,7 +116,7 @@ tap.test('ERR-06: Malformed MIME handling - Invalid boundary', async (tools) =>
response.includes('malformed');
console.log('Malformed MIME response:', response.substring(0, 100));
expect(validResponse).toBeTrue();
expect(validResponse).toEqual(true);
socket.write('QUIT\r\n');
socket.end();
@ -228,7 +228,7 @@ tap.test('ERR-06: Malformed MIME handling - Missing headers', async (tools) => {
response.includes('451');
console.log('Missing headers response:', response.substring(0, 100));
expect(validResponse).toBeTrue();
expect(validResponse).toEqual(true);
socket.write('QUIT\r\n');
socket.end();
@ -349,7 +349,7 @@ tap.test('ERR-06: Malformed MIME handling - Nested multipart errors', async (too
response.includes('451');
console.log('Nested multipart response:', response.substring(0, 100));
expect(validResponse).toBeTrue();
expect(validResponse).toEqual(true);
socket.write('QUIT\r\n');
socket.end();

View File

@ -73,7 +73,7 @@ tap.test('Permanent Failures - should return 5xx for invalid recipient syntax',
const permanentFailureCodes = ['550', '551', '552', '553', '554', '501'];
const isPermanentFailure = permanentFailureCodes.some(code => rcptResponse.includes(code));
expect(isPermanentFailure).toBeTrue();
expect(isPermanentFailure).toEqual(true);
// Clean up
socket.write('QUIT\r\n');
@ -142,7 +142,7 @@ tap.test('Permanent Failures - should handle non-existent domain', async (tools)
// 2. Reject with permanent failure (5xx)
// Both are valid approaches
const acceptedOrRejected = rcptResponse.includes('250') || /^5\d{2}/.test(rcptResponse);
expect(acceptedOrRejected).toBeTrue();
expect(acceptedOrRejected).toEqual(true);
if (rcptResponse.includes('250')) {
console.log('Server accepts unknown domains (will handle bounces later)');
@ -297,7 +297,7 @@ tap.test('Permanent Failures - should persist after RSET', async (tools) => {
console.log('Permanent failures persist correctly after RSET');
} else {
console.log('Server accepts invalid syntax in MAIL FROM (lenient parsing)');
expect(true).toBeTrue();
expect(true).toEqual(true);
}
// Clean up
@ -311,7 +311,7 @@ tap.test('Permanent Failures - should persist after RSET', async (tools) => {
tap.test('cleanup - stop SMTP server', async () => {
await stopTestServer(testServer);
expect(true).toBeTrue();
expect(true).toEqual(true);
});
tap.start();

View File

@ -1,7 +1,7 @@
import * as plugins from '@git.zone/tstest/tapbundle';
import { expect, tap } 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';
const TEST_PORT = 2525;
@ -120,7 +120,7 @@ tap.test('ERR-05: Resource exhaustion handling - Connection limit', async (tools
console.log(`Exhaustion detected: ${exhaustionDetected}`);
if (lastError) console.log(`Last error: ${lastError}`);
expect(hasResourceProtection).toBeTrue();
expect(hasResourceProtection).toEqual(true);
done.resolve();
} catch (error) {
console.error('Test error:', error);
@ -236,12 +236,12 @@ tap.test('ERR-05: Resource exhaustion handling - Memory limits', async (tools) =
}
// Resource protection is working if we got an error or protective response
expect(resourceError || endResponse.includes('552') || endResponse.includes('451')).toBeTrue();
expect(resourceError || endResponse.includes('552') || endResponse.includes('451')).toEqual(true);
} catch (err) {
// Errors during large data transmission indicate resource protection
console.log('Expected resource protection error:', err);
expect(true).toBeTrue();
expect(true).toEqual(true);
}
socket.write('QUIT\r\n');

View File

@ -135,7 +135,7 @@ tap.test('Temporary Failures - should allow retry after temporary failure', asyn
const attempt2 = await attemptConnection(2);
// At least one attempt should work
expect(attempt1.success || attempt2.success).toBeTrue();
expect(attempt1.success || attempt2.success).toEqual(true);
done.resolve();