-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { PersonEmailPipe } from './person-email-pipe'; | ||
import { buildPersonWithEmails } from '../../../spec-builders'; | ||
|
||
describe('person email pipe', () => { | ||
let personEmailPipe: PersonEmailPipe; | ||
|
||
beforeEach(() => { | ||
personEmailPipe = new PersonEmailPipe(); | ||
}); | ||
|
||
it('should return null for a person without any email set', () => { | ||
expect(personEmailPipe.transform(buildPersonWithEmails(12345))).toBeNull(); | ||
}); | ||
|
||
it('should return the first email address if all options have values', () => { | ||
expect( | ||
personEmailPipe.transform( | ||
buildPersonWithEmails( | ||
12345, | ||
'first@email.ch', | ||
'second@email.ch', | ||
'third@email.ch' | ||
) | ||
) | ||
).toBe('first@email.ch'); | ||
}); | ||
|
||
it('should return the email address with a value ', () => { | ||
expect( | ||
personEmailPipe.transform( | ||
buildPersonWithEmails(12345, undefined, 'second@email.ch', undefined) | ||
) | ||
).toBe('second@email.ch'); | ||
}); | ||
|
||
it('should return the first email address with a value ', () => { | ||
expect( | ||
personEmailPipe.transform( | ||
buildPersonWithEmails( | ||
12345, | ||
undefined, | ||
'second@email.ch', | ||
'third@email.ch' | ||
) | ||
) | ||
).toBe('second@email.ch'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters