regex.test.ts 399 B

12345678910111213
  1. import { email } from '../regex'
  2. describe('email regex', () => {
  3. it('rejects wrong email', () => {
  4. const wrongEmail = 'i am not an email'.match(email)
  5. expect(wrongEmail).toBe(null)
  6. })
  7. it('parses simple emails', () => {
  8. const simpleEmail = 'tomi@cvetic.ch'.match(email)
  9. expect(simpleEmail).not.toBe(null)
  10. expect(simpleEmail && simpleEmail[0]).toBe('tomi@cvetic.ch')
  11. })
  12. })