Remove unused UUID string validator & test
parent
2b026d8660
commit
6002526fd6
|
@ -1,6 +0,0 @@
|
|||
// uses Gajus' regex matcher from https://stackoverflow.com/questions/136505/searching-for-uuids-in-text-with-regex
|
||||
export const isUUIDv4 = str =>
|
||||
str.length === 36 &&
|
||||
!!str.match(
|
||||
/[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}/
|
||||
)
|
|
@ -1,24 +0,0 @@
|
|||
import uuid from 'uuid'
|
||||
|
||||
import {isUUIDv4} from 'src/utils/stringValidators'
|
||||
|
||||
describe('isUUIDv4', () => {
|
||||
it('returns false for non-matches', () => {
|
||||
const inputWrongLength = 'abcd'
|
||||
expect(isUUIDv4(inputWrongLength)).toEqual(false)
|
||||
|
||||
const inputWrongFormat = 'abcdefghijklmnopqrstuvwxyz1234567890'
|
||||
expect(isUUIDv4(inputWrongFormat)).toEqual(false)
|
||||
|
||||
const inputWrongCharRange = 'z47ac10b-58cc-4372-a567-0e02b2c3d479'
|
||||
expect(isUUIDv4(inputWrongCharRange)).toEqual(false)
|
||||
})
|
||||
|
||||
it('returns true for matches', () => {
|
||||
const inputRight = 'a47ac10b-58cc-4372-a567-0e02b2c3d479'
|
||||
expect(isUUIDv4(inputRight)).toEqual(true)
|
||||
|
||||
const inputRightFromLibrary = uuid.v4()
|
||||
expect(isUUIDv4(inputRightFromLibrary)).toEqual(true)
|
||||
})
|
||||
})
|
Loading…
Reference in New Issue