refs #540 Fix domain validation for short domain
This commit is contained in:
parent
a9a9a71494
commit
e70c022e92
|
@ -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)
|
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