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,50 @@
|
||||
import { tap, expect } 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('CPERF-08: DNS Caching Tests', async () => {
|
||||
console.log('\n🌐 Testing SMTP Client DNS Caching');
|
||||
console.log('=' .repeat(60));
|
||||
|
||||
const testServer = await createTestServer({});
|
||||
|
||||
try {
|
||||
console.log('\nTest: DNS caching with multiple connections');
|
||||
|
||||
// Create multiple clients to test DNS caching
|
||||
const clients = [];
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const smtpClient = createTestSmtpClient({
|
||||
host: testServer.hostname,
|
||||
port: testServer.port
|
||||
});
|
||||
clients.push(smtpClient);
|
||||
console.log(` ✓ Client ${i + 1} created (DNS should be cached)`);
|
||||
}
|
||||
|
||||
// Send email with first client
|
||||
const email = new Email({
|
||||
from: 'sender@example.com',
|
||||
to: 'recipient@example.com',
|
||||
subject: 'DNS Caching Test',
|
||||
text: 'Testing DNS caching efficiency'
|
||||
});
|
||||
|
||||
const result = await clients[0].sendMail(email);
|
||||
console.log(' ✓ Email sent successfully');
|
||||
expect(result).toBeDefined();
|
||||
|
||||
// Clean up all clients
|
||||
clients.forEach(client => client.close());
|
||||
console.log(' ✓ All clients closed');
|
||||
|
||||
console.log('\n✅ CPERF-08: DNS caching tests completed');
|
||||
|
||||
} finally {
|
||||
testServer.server.close();
|
||||
}
|
||||
});
|
||||
|
||||
tap.start();
|
||||
Reference in New Issue
Block a user