Reinstate mocks.email.mock(), it wasn't as unused as I thought.

This commit is contained in:
Sam Rose 2025-02-27 14:27:34 +00:00
parent 15ef247ba1
commit e4ae1d90b1
No known key found for this signature in database
1 changed files with 14 additions and 0 deletions

View File

@ -2,6 +2,20 @@ import MailDev from "maildev"
import { promisify } from "util"
import TestConfiguration from "../TestConfiguration"
/**
* @deprecated please use the `MailDev` email server instead of this mock.
*/
export function mock() {
// mock the email system
const sendMailMock = jest.fn()
const nodemailer = require("nodemailer")
nodemailer.createTransport.mockReturnValue({
sendMail: sendMailMock,
verify: jest.fn(),
})
return sendMailMock
}
export type Mailserver = InstanceType<typeof MailDev>
export type MailserverConfig = ConstructorParameters<typeof MailDev>[0]