Use receipient address in the envelope field

This commit is contained in:
Hongbo Wu
2023-03-23 18:18:33 +08:00
parent fe03e78f49
commit ea3077ea2e
2 changed files with 42 additions and 13 deletions

View File

@ -1,5 +1,6 @@
import 'mocha'
import { expect } from 'chai'
import 'mocha'
import { parsedTo } from '../src'
import {
getConfirmationCode,
isConfirmationEmail,
@ -90,3 +91,23 @@ describe('Newsletter email test', () => {
})
})
})
describe('parsedTo', () => {
it('returns envelope to if exists', () => {
const to = 'receipient@inbox.omnivore.app'
expect(
parsedTo({
envelope: `{"to":["${to}"],"from":"sender@omnivore.app"}`,
})
).to.equal(to)
})
it('returns parsed to if envelope does not exists', () => {
const to = 'receipient@inbox.omnivore.app'
expect(
parsedTo({
to,
})
).to.equal(to)
})
})