import nodemailer from "nodemailer" ; import { createApp } from "../src/app" ; const mailer = nodemailer . createTransport ( { jsonTransport : true , } ) ; export const fakeInbox = { } ; const sendMail = mailer . sendMail . bind ( mailer ) ; mailer . sendMail = async ( opts ) => { const info = await sendMail ( opts ) ; info . message = JSON . parse ( info . message ) ; const key = String ( opts . to ) ; if ( ! fakeInbox [ key ] ) { fakeInbox [ key ] = [ ] ; } fakeInbox [ key ] . push ( info ) ; return info ; } ; export const app = createApp ( mailer ) ;