@fakes/email-vitest
v0.1.0-first-a3ceb13-20230926205536
Published
fake mail integration for vitest
Downloads
2
Readme
import { expect, test } from 'vitest'
import { setupSmtpServer } from '@fakes/email-vitest'
import * as nodemailer from 'nodemailer'
import * as Chai from 'chai'
import { ChaiEmail } from '@fakes/email-chai'
Chai.use(ChaiEmail)
const smtpServer = setupSmtpServer()
test('sender', async () => {
const transporter = nodemailer.createTransport({
host: 'localhost',
port: smtpServer.port,
})
await transporter.sendMail({
from: '[email protected]',
to: '[email protected]',
subject: 'Hello World!',
text: 'How are you doing',
})
const email = smtpServer.inbox.singleEmail()
expect(email).from('[email protected]')
})