-
-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
Type: BugThe issue has indentified a bugThe issue has indentified a bug
Description
Package version
9.2.0
Describe the bug
Hi, i tried to do like the documentation :
import { test } from '@japa/runner'
import mail from '@adonisjs/mail/services/main'
import VerifyEmailNotification from '#mails/verify_email'
test.group('Users | register', () => {
test('create a new user account', async ({ client, route }) => {
/**
* Turn on the fake mode
*/
const { mails } = mail.fake()
/**
* Make an API call
*/
await client
.post(route('users.store'))
.send(userData)
/**
* Assert the controller indeed sent the
* VerifyEmailNotification mail
*/
mails.assertSent(VerifyEmailNotification, ({ message }) => {
return message
.hasTo(userData.email)
.hasSubject('Verify email address')
})
})
})And here is my code with all errors :

And here is my mail class :
import env from '#start/env'
import { BaseMail } from '@adonisjs/mail'
export default class SendPasswordTokenNotification extends BaseMail {
from = env.get('SENDER_EMAIL')
subject = 'Votre code de réinitialisation de mot de passe'
to: string
payload: any
constructor(private email: string, private data: { token: string }) {
super()
this.to = email
this.payload = data
}
/**
* The "prepare" method is called automatically when
* the email is sent or queued.
*/
prepare() {
this.message.to(this.to)
this.message.htmlView('emails/send_password_token', this.payload)
}
}(I don't know if it's the good way to pass data in the mail class but the documentation doesn't show it :/)
Reproduction repo
No response
Metadata
Metadata
Assignees
Labels
Type: BugThe issue has indentified a bugThe issue has indentified a bug