Merge pull request #544 from h3poteto/iss-540

closes #540 Fix domain validation for short domain
This commit is contained in:
AkiraFukushima 2018-08-20 22:13:01 +09:00 committed by GitHub
commit 937d13b5fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
})
})
}) })
}) })