mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-07 11:08:54 +08:00
Modify ValidateEmail.js to accept all suffixes
This commit is contained in:
23
String/test/ValidateEmail.test.js
Normal file
23
String/test/ValidateEmail.test.js
Normal file
@ -0,0 +1,23 @@
|
||||
import { validateEmail } from '../ValidateEmail'
|
||||
|
||||
describe('Validation of an Email Address', () => {
|
||||
it('expects to return false', () => {
|
||||
expect(validateEmail('mahfoudh.arous.com')).toEqual(false)
|
||||
})
|
||||
|
||||
it('expects to return false', () => {
|
||||
expect(validateEmail('mahfoudh.arous@com')).toEqual(false)
|
||||
})
|
||||
|
||||
it('expects to return true', () => {
|
||||
expect(validateEmail('mahfoudh.arous@gmail.com')).toEqual(true)
|
||||
})
|
||||
|
||||
it('expects to return true', () => {
|
||||
expect(validateEmail('icristianbaciu@.helsinki.edu')).toEqual(true)
|
||||
})
|
||||
|
||||
it('expects to throw a type error', () => {
|
||||
expect(() => { validateEmail('') }).toThrow('Email Address String Null or Empty.')
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user