mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Return empty name if name not found in from header
This commit is contained in:
parent
c99c1db57e
commit
3a120b8f47
2 changed files with 13 additions and 6 deletions
|
|
@ -577,5 +577,5 @@ export const parseEmailAddress = (from: string): addressparser.EmailAddress => {
|
|||
if (parsed.length > 0) {
|
||||
return parsed[0]
|
||||
}
|
||||
return { name: from, address: from }
|
||||
return { name: '', address: from }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,11 +182,18 @@ describe('getTitleFromEmailSubject', () => {
|
|||
})
|
||||
|
||||
describe('parseEmailAddress', () => {
|
||||
const email = 'Tester <tester@omnivore.app>'
|
||||
it('returns the name and address when in name <address> format', () => {
|
||||
const name = 'test name'
|
||||
const address = 'tester@omnivore.app'
|
||||
const parsed = parseEmailAddress(`${name} <${address}>`)
|
||||
expect(parsed.name).to.eql(name)
|
||||
expect(parsed.address).to.eql(address)
|
||||
})
|
||||
|
||||
it('returns the name and address', () => {
|
||||
const { name, address } = parseEmailAddress(email)
|
||||
expect(name).to.eql('Tester')
|
||||
expect(address).to.eql('tester@omnivore.app')
|
||||
it('returns the address when in address format', () => {
|
||||
const address = 'tester@omnivore.app'
|
||||
const parsed = parseEmailAddress(address)
|
||||
expect(parsed.name).to.eql('')
|
||||
expect(parsed.address).to.eql(address)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue