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,5 +1,5 @@
import { SmtpClient } from '../../ts/mail/delivery/classes.smtp.client.js';
import type { ISmtpClientOptions } from '../../ts/mail/delivery/smtpclient/interfaces.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';
/**
@ -21,7 +21,7 @@ export function createTestSmtpClient(options: Partial<ISmtpClientOptions> = {}):
}
};
return new SmtpClient(defaultOptions);
return smtpClientMod.createSmtpClient(defaultOptions);
}
/**

View File

@ -4,7 +4,7 @@ import * as plugins from '../ts/plugins.js';
import DcRouter from '../ts/classes.dcrouter.js';
import { EmailService } from '../ts/mail/services/classes.emailservice.js';
import { BounceManager } from '../ts/mail/core/classes.bouncemanager.js';
import { SmtpClient } from '../ts/mail/delivery/classes.smtp.client.js';
import { smtpClientMod } from '../ts/mail/delivery/index.js';
import { SmtpServer } from '../ts/mail/delivery/smtpserver/smtp-server.js';
// Test the new integration architecture
@ -83,7 +83,7 @@ tap.test('SMTP client should be able to connect to SMTP server', async (tools) =
socketTimeout: 5000
};
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// Verify it was created properly
expect(smtpClient).toBeTruthy();

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 = () => {};

View File

@ -1,8 +1,8 @@
import { tap, expect } from '@git.zone/tstest/tapbundle';
import * as plugins from '../ts/plugins.js';
import * as paths from '../ts/paths.js';
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';
/**
@ -19,7 +19,7 @@ tap.test('verify SMTP client initialization', async () => {
};
// Create SMTP client instance
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// Verify instance was created correctly
expect(smtpClient).toBeTruthy();
@ -35,7 +35,7 @@ tap.test('test SMTP client configuration update', async () => {
};
// Create SMTP client instance
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// Update configuration
smtpClient.updateOptions({
@ -117,7 +117,7 @@ tap.test('verify SMTP client email delivery functionality with mock', async () =
};
// Create SMTP client instance
const smtpClient = new SmtpClient(options);
const smtpClient = smtpClientMod.createSmtpClient(options);
// Test public methods exist and have correct signatures
expect(typeof smtpClient.sendMail).toEqual('function');
@ -144,7 +144,7 @@ tap.test('verify SMTP client email delivery functionality with mock', async () =
tap.test('test SMTP client error handling with mock', async () => {
// Create SMTP client instance
const smtpClient = new SmtpClient({
const smtpClient = smtpClientMod.createSmtpClient({
host: 'smtp.example.com',
port: 587,
secure: false