Make subject optional too
This commit is contained in:
@ -36,7 +36,7 @@ interface EmailMessage {
|
||||
}
|
||||
|
||||
function isEmailMessage(data: any): data is EmailMessage {
|
||||
return 'from' in data && 'to' in data && 'subject' in data
|
||||
return 'from' in data && 'to' in data
|
||||
}
|
||||
|
||||
const logger = buildLogger('app.dispatch')
|
||||
|
||||
@ -163,5 +163,20 @@ describe('Emails Router', () => {
|
||||
|
||||
expect(res.body.id).not.to.be.undefined
|
||||
})
|
||||
|
||||
it('saves the email if subject is empty', async () => {
|
||||
const data = {
|
||||
from,
|
||||
to: newsletterEmail,
|
||||
html,
|
||||
}
|
||||
const res = await request
|
||||
.post(url)
|
||||
.set('Authorization', `${authToken}`)
|
||||
.send(data)
|
||||
.expect(200)
|
||||
|
||||
expect(res.body.id).not.to.be.undefined
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user