fix(structure): Unify structure even further
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as plugins from '../ts/plugins.js';
|
||||
import { BounceManager, BounceType, BounceCategory } from '../ts/mail/core/classes.bouncemanager.js';
|
||||
import { Email } from '../ts/mail/core/classes.email.js';
|
||||
|
||||
/**
|
||||
* Test the BounceManager class
|
||||
@ -103,11 +103,11 @@ tap.test('BounceManager - should process SMTP failures correctly', async () => {
|
||||
tap.test('BounceManager - should process bounce emails correctly', async () => {
|
||||
const bounceManager = new BounceManager();
|
||||
|
||||
// Create a mock bounce email as Smartmail
|
||||
const bounceEmail = new plugins.smartmail.Smartmail({
|
||||
// Create a mock bounce email
|
||||
const bounceEmail = new Email({
|
||||
from: 'mailer-daemon@example.com',
|
||||
subject: 'Mail delivery failed: returning message to sender',
|
||||
body: `
|
||||
text: `
|
||||
This message was created automatically by mail delivery software.
|
||||
|
||||
A message that you sent could not be delivered to one or more of its recipients.
|
||||
@ -123,7 +123,7 @@ tap.test('BounceManager - should process bounce emails correctly', async () => {
|
||||
Status: 5.2.2
|
||||
diagnostic-code: smtp; 552 5.2.2 Mailbox full
|
||||
`,
|
||||
creationObjectRef: {}
|
||||
to: 'sender@example.com' // Bounce emails are typically sent back to the original sender
|
||||
});
|
||||
|
||||
const result = await bounceManager.processBounceEmail(bounceEmail);
|
||||
|
@ -76,7 +76,7 @@ tap.test('TemplateManager - should register and retrieve templates', async (tool
|
||||
expect(templates.some(t => t.id === 'test-template')).toEqual(true);
|
||||
});
|
||||
|
||||
tap.test('TemplateManager - should create smartmail from template', async (tools) => {
|
||||
tap.test('TemplateManager - should create email from template', async (tools) => {
|
||||
const templateManager = new TemplateManager({
|
||||
from: 'test@example.com'
|
||||
});
|
||||
@ -93,15 +93,15 @@ tap.test('TemplateManager - should create smartmail from template', async (tools
|
||||
category: 'test'
|
||||
});
|
||||
|
||||
// Create smartmail from template
|
||||
const smartmail = await templateManager.createSmartmail('welcome-test', {
|
||||
// Create email from template
|
||||
const email = await templateManager.createEmail('welcome-test', {
|
||||
name: 'John Doe'
|
||||
});
|
||||
|
||||
expect(smartmail).toBeTruthy();
|
||||
expect(smartmail.options.from).toEqual('welcome@example.com');
|
||||
expect(smartmail.getSubject()).toEqual('Welcome, John Doe!');
|
||||
expect(smartmail.getBody(true).indexOf('Hello, John Doe!') > -1).toEqual(true);
|
||||
expect(email).toBeTruthy();
|
||||
expect(email.from).toEqual('welcome@example.com');
|
||||
expect(email.getSubjectWithVariables()).toEqual('Welcome, John Doe!');
|
||||
expect(email.getHtmlWithVariables()?.indexOf('Hello, John Doe!') > -1).toEqual(true);
|
||||
});
|
||||
|
||||
tap.test('Email - should handle template variables', async (tools) => {
|
||||
|
Reference in New Issue
Block a user