mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-05 16:26:47 +08:00
merge: Add ValidateUrl in String (#856)
* Add ValidateUrl in String * change regex * Bug fix
This commit is contained in:
14
String/test/ValidateUrl.test.js
Normal file
14
String/test/ValidateUrl.test.js
Normal file
@ -0,0 +1,14 @@
|
||||
import { validateURL } from '../ValidateUrl'
|
||||
|
||||
describe('ValidateUrl', () => {
|
||||
it('expects to return false', () => {
|
||||
expect(validateURL('google')).toEqual(false)
|
||||
expect(validateURL('link: https://www.google.com')).toEqual(false)
|
||||
})
|
||||
|
||||
it('expects to return true', () => {
|
||||
expect(validateURL('http://www.google.com')).toEqual(true)
|
||||
expect(validateURL('https://www.google.com')).toEqual(true)
|
||||
expect(validateURL('www.google.com')).toEqual(true)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user