Merge pull request #544 from h3poteto/iss-540
closes #540 Fix domain validation for short domain
This commit is contained in:
commit
937d13b5fa
|
@ -1 +1 @@
|
|||
export const domainFormat = new RegExp(/^[a-zA-Z0-9][a-zA-Z0-9-.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/)
|
||||
export const domainFormat = new RegExp(/^[a-zA-Z0-9][a-zA-Z0-9-.]{0,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/)
|
||||
|
|
|
@ -52,5 +52,12 @@ describe('validator', () => {
|
|||
assert.strictEqual(res, 0)
|
||||
})
|
||||
})
|
||||
context('string is short domain', () => {
|
||||
const domain = 'id.cc'
|
||||
it('should match', () => {
|
||||
const res = domain.search(domainFormat)
|
||||
assert.strictEqual(res, 0)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue