refs #434 Fix domain format for subdomain

This commit is contained in:
AkiraFukushima 2018-07-12 08:58:05 +09:00
parent bce8cf9ce9
commit 584774b2a2
2 changed files with 9 additions and 2 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-.]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$/)

View File

@ -1,4 +1,4 @@
var assert = require('assert')
import assert from 'assert'
import { domainFormat } from '../../src/renderer/utils/validator'
describe('validator', () => {
@ -38,5 +38,12 @@ describe('validator', () => {
assert.equal(res, 0)
})
})
context('string contains hyphone', () => {
const domain = 'music-mastodon.social'
it('should match', () => {
const res = domain.search(domainFormat)
assert.equal(res, 0)
})
})
})
})