mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Accept null value for text in an email
This commit is contained in:
parent
c4905aaba8
commit
ac6f5b497c
2 changed files with 18 additions and 9 deletions
|
|
@ -36,13 +36,7 @@ interface EmailMessage {
|
|||
}
|
||||
|
||||
function isEmailMessage(data: any): data is EmailMessage {
|
||||
return (
|
||||
'from' in data &&
|
||||
'to' in data &&
|
||||
'subject' in data &&
|
||||
'html' in data &&
|
||||
'text' in data
|
||||
)
|
||||
return 'from' in data && 'to' in data && 'subject' in data
|
||||
}
|
||||
|
||||
const logger = buildLogger('app.dispatch')
|
||||
|
|
|
|||
|
|
@ -125,6 +125,7 @@ describe('Emails Router', () => {
|
|||
})
|
||||
|
||||
describe('create', () => {
|
||||
const url = '/svc/pubsub/emails/save'
|
||||
const html = '<html>test html</html>'
|
||||
const text = 'test text'
|
||||
const from = 'fake from'
|
||||
|
|
@ -140,12 +141,26 @@ describe('Emails Router', () => {
|
|||
subject,
|
||||
}
|
||||
const res = await request
|
||||
.post('/svc/pubsub/emails/save')
|
||||
.post(url)
|
||||
.set('Authorization', `${authToken}`)
|
||||
.send(data)
|
||||
.expect(200)
|
||||
|
||||
expect(res.body.id).not.to.be.undefined
|
||||
})
|
||||
|
||||
it('saves the email if body is empty', async () => {
|
||||
const data = {
|
||||
from,
|
||||
to: newsletterEmail,
|
||||
subject,
|
||||
}
|
||||
const res = await request
|
||||
.post(url)
|
||||
.set('Authorization', `${authToken}`)
|
||||
.send(data)
|
||||
.expect(200)
|
||||
|
||||
console.log(res.body)
|
||||
expect(res.body.id).not.to.be.undefined
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue