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,52 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import { createTestServer } from '../../helpers/server.loader.ts';
|
||||
import { createTestSmtpClient } from '../../helpers/smtp.client.ts';
|
||||
|
||||
tap.test('CREL-07: Resource Cleanup Tests', async () => {
|
||||
console.log('\n🧹 Testing SMTP Client Resource Cleanup');
|
||||
console.log('=' .repeat(60));
|
||||
|
||||
const testServer = await createTestServer({});
|
||||
|
||||
try {
|
||||
console.log('\nTest 1: Basic client creation and cleanup');
|
||||
|
||||
// Create a client
|
||||
const smtpClient = createTestSmtpClient({
|
||||
host: testServer.hostname,
|
||||
port: testServer.port
|
||||
});
|
||||
console.log(' ✓ Client created');
|
||||
|
||||
// Verify connection
|
||||
try {
|
||||
const verifyResult = await smtpClient.verify();
|
||||
console.log(' ✓ Connection verified:', verifyResult);
|
||||
} catch (error) {
|
||||
console.log(' ⚠️ Verify failed:', error.message);
|
||||
}
|
||||
|
||||
// Close the client
|
||||
smtpClient.close();
|
||||
console.log(' ✓ Client closed');
|
||||
|
||||
console.log('\nTest 2: Multiple close calls');
|
||||
const testClient = createTestSmtpClient({
|
||||
host: testServer.hostname,
|
||||
port: testServer.port
|
||||
});
|
||||
|
||||
// Close multiple times - should not throw
|
||||
testClient.close();
|
||||
testClient.close();
|
||||
testClient.close();
|
||||
console.log(' ✓ Multiple close calls handled safely');
|
||||
|
||||
console.log('\n✅ CREL-07: Resource cleanup tests completed');
|
||||
|
||||
} finally {
|
||||
testServer.server.close();
|
||||
}
|
||||
});
|
||||
|
||||
tap.start();
|
||||
Reference in New Issue
Block a user