This commit is contained in:
2025-05-26 14:50:55 +00:00
parent 20583beb35
commit a3721f7a74
22 changed files with 2820 additions and 8112 deletions

View File

@ -1,7 +1,7 @@
import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as plugins from './plugins.js';
import { createTestServer } from '../../helpers/server.loader.js';
import { createSmtpClient } from '../../helpers/smtp.client.js';
import { createTestSmtpClient } from '../../helpers/smtp.client.js';
import { Email } from '../../../ts/index.js';
tap.test('CRFC-05: should comply with SMTP state machine (RFC 5321)', async (tools) => {
const testId = 'CRFC-05-state-machine';
@ -62,7 +62,7 @@ tap.test('CRFC-05: should comply with SMTP state machine (RFC 5321)', async (too
}
});
const smtpClient = createSmtpClient({
const smtpClient = createTestSmtpClient({
host: testServer.hostname,
port: testServer.port,
secure: false
@ -165,13 +165,13 @@ tap.test('CRFC-05: should comply with SMTP state machine (RFC 5321)', async (too
}
});
const smtpClient = createSmtpClient({
const smtpClient = createTestSmtpClient({
host: testServer.hostname,
port: testServer.port,
secure: false
});
const email = new plugins.smartmail.Email({
const email = new Email({
from: 'sender@example.com',
to: ['recipient1@example.com', 'recipient2@example.com'],
subject: 'State machine test',
@ -424,7 +424,7 @@ tap.test('CRFC-05: should comply with SMTP state machine (RFC 5321)', async (too
}
});
const smtpClient = createSmtpClient({
const smtpClient = createTestSmtpClient({
host: testServer.hostname,
port: testServer.port,
secure: false
@ -546,7 +546,7 @@ tap.test('CRFC-05: should comply with SMTP state machine (RFC 5321)', async (too
}
});
const smtpClient = createSmtpClient({
const smtpClient = createTestSmtpClient({
host: testServer.hostname,
port: testServer.port,
secure: false,
@ -556,7 +556,7 @@ tap.test('CRFC-05: should comply with SMTP state machine (RFC 5321)', async (too
// Send multiple emails through same connection
for (let i = 1; i <= 3; i++) {
const email = new plugins.smartmail.Email({
const email = new Email({
from: 'sender@example.com',
to: [`recipient${i}@example.com`],
subject: `Persistence test ${i}`,
@ -648,7 +648,7 @@ tap.test('CRFC-05: should comply with SMTP state machine (RFC 5321)', async (too
}
});
const smtpClient = createSmtpClient({
const smtpClient = createTestSmtpClient({
host: testServer.hostname,
port: testServer.port,
secure: false
@ -676,7 +676,7 @@ tap.test('CRFC-05: should comply with SMTP state machine (RFC 5321)', async (too
for (const testEmail of testEmails) {
console.log(` Testing ${testEmail.desc}...`);
const email = new plugins.smartmail.Email({
const email = new Email({
from: testEmail.from,
to: testEmail.to,
subject: `Error recovery test: ${testEmail.desc}`,
@ -698,4 +698,6 @@ tap.test('CRFC-05: should comply with SMTP state machine (RFC 5321)', async (too
})();
console.log(`\n${testId}: All ${scenarioCount} state machine scenarios tested ✓`);
});
});
tap.start();