@fakes/email-vitest

0.1.0-first-a3ceb13-20230926205536 • Public • Published
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: 'sender@example.org',
        to: 'recipient@example.org',
        subject: 'Hello World!',
        text: 'How are you doing',
    })
    const email = smtpServer.inbox.singleEmail()
    expect(email).from('sender@example.org')
})

Package Sidebar

Install

npm i @fakes/email-vitest

Weekly Downloads

1

Version

0.1.0-first-a3ceb13-20230926205536

License

none

Unpacked Size

6.2 kB

Total Files

10

Last publish

Collaborators

  • catch-22