Skip to content

signed/email-fake

Repository files navigation

email-fake

Want to test your email sending code down to the wire? Don't want to rely on hard coded email accounts? With email-fake you can spin up a local smtp server in your tests to receive your emails. Email-fake builds on top of smtp-server and mailparser to process incoming email. The technical details are hidden behind an Inbox abstraction. To further ease testing and improve the readability of your tests there are some chai assertions for common email properties. With the vitest integration running a smtp server boils down to those few lines:

import { test } from 'vitest'
import { setupSmtpServer } from '@fakes/email-vitest'

const smtpServer = setupSmtpServer()

test('send email', () => {
  // execute your mail sending code
  sendMail(smtpServer.port)
  const email = smtpServer.inbox.singleEmail()
  //assert the properties you care about  
})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published