refs #540 Fix domain validation for short domain

This commit is contained in:
AkiraFukushima 2018-08-20 22:01:10 +09:00
parent a9a9a71494
commit e70c022e92
2 changed files with 8 additions and 1 deletions

View File

@ -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,}$/)

View File

@ -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)
})
})
}) })
}) })