This commit is contained in:
2025-05-27 10:39:29 +00:00
parent 69304dc839
commit c3b14c0f58
6 changed files with 25 additions and 132 deletions

View File

@ -1,6 +1,6 @@
import { tap, expect } from '@git.zone/tstest/tapbundle';
import { SmtpClient } from '../ts/mail/delivery/classes.smtp.client.js';
import type { ISmtpClientOptions } from '../ts/mail/delivery/classes.smtp.client.js';
import { smtpClientMod } from '../ts/mail/delivery/index.js';
import type { ISmtpClientOptions, SmtpClient } from '../ts/mail/delivery/smtpclient/index.js';
import { Email } from '../ts/mail/core/classes.email.js';
/**
@ -18,7 +18,7 @@ tap.test('verify backward compatibility - client creation', async () => {
};
// Create SMTP client instance using legacy constructor
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// Verify instance was created correctly
expect(smtpClient).toBeTruthy();
@ -32,7 +32,7 @@ tap.test('verify backward compatibility - methods exist', async () => {
secure: false
};
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// Verify all expected methods exist
expect(typeof smtpClient.sendMail === 'function').toBeTruthy();
@ -53,7 +53,7 @@ tap.test('verify backward compatibility - options update', async () => {
secure: false
};
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// Test option updates don't throw
expect(() => smtpClient.updateOptions({
@ -76,7 +76,7 @@ tap.test('verify backward compatibility - connection failure handling', async ()
connectionTimeout: 1000 // Short timeout for faster test
};
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// verify() should return false for invalid hosts
const isValid = await smtpClient.verify();
@ -109,7 +109,7 @@ tap.test('verify backward compatibility - pool status', async () => {
maxConnections: 5
};
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// Get pool status
const status = smtpClient.getPoolStatus();
@ -133,7 +133,7 @@ tap.test('verify backward compatibility - event handling', async () => {
secure: false
};
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// Test event listener methods don't throw
const testListener = () => {};