feat(storage): add comprehensive tests for StorageManager with memory, filesystem, and custom function backends
feat(email): implement EmailSendJob class for robust email delivery with retry logic and MX record resolution feat(mail): restructure mail module exports for simplified access to core and delivery functionalities
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import { createTestServer } from '../../helpers/server.loader.ts';
|
||||
import { createTestSmtpClient } from '../../helpers/smtp.client.ts';
|
||||
import { Email } from '../../../ts/mail/core/classes.email.ts';
|
||||
|
||||
tap.test('CRFC-04: SMTP Response Code Handling', async () => {
|
||||
console.log('\n📧 Testing SMTP Client Response Code Handling');
|
||||
console.log('=' .repeat(60));
|
||||
|
||||
const testServer = await createTestServer({});
|
||||
|
||||
try {
|
||||
const smtpClient = createTestSmtpClient({
|
||||
host: testServer.hostname,
|
||||
port: testServer.port
|
||||
});
|
||||
|
||||
console.log('\nTest 1: Successful email (2xx responses)');
|
||||
const email1 = new Email({
|
||||
from: 'sender@example.com',
|
||||
to: ['recipient@example.com'],
|
||||
subject: 'Success test',
|
||||
text: 'Testing successful response codes'
|
||||
});
|
||||
|
||||
const result1 = await smtpClient.sendMail(email1);
|
||||
console.log(' ✓ 2xx response codes handled correctly');
|
||||
expect(result1).toBeDefined();
|
||||
|
||||
console.log('\nTest 2: Verify connection');
|
||||
const verified = await smtpClient.verify();
|
||||
console.log(' ✓ Connection verification successful');
|
||||
expect(verified).toBeDefined();
|
||||
|
||||
console.log('\nTest 3: Multiple recipients (multiple 250 responses)');
|
||||
const email2 = new Email({
|
||||
from: 'sender@example.com',
|
||||
to: ['user1@example.com', 'user2@example.com', 'user3@example.com'],
|
||||
subject: 'Multiple recipients',
|
||||
text: 'Testing multiple positive responses'
|
||||
});
|
||||
|
||||
const result2 = await smtpClient.sendMail(email2);
|
||||
console.log(' ✓ Multiple positive responses handled');
|
||||
expect(result2).toBeDefined();
|
||||
|
||||
console.log('\n✅ CRFC-04: Response code handling tests completed');
|
||||
|
||||
} finally {
|
||||
testServer.server.close();
|
||||
}
|
||||
});
|
||||
|
||||
tap.start();
|
||||
Reference in New Issue
Block a user