refs #434 Fix domain format for subdomain
This commit is contained in:
parent
bce8cf9ce9
commit
584774b2a2
|
@ -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,}$/)
|
||||
|
|
|
@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue