Blame view
tests/unit/utils/validate.spec.js
1.3 KB
d7d9c38c2 auto commit the c... |
1 |
import { validUsername, validURL, validLowerCase, validUpperCase, validAlphabets } from '@/utils/validate.js' |
80a28914e init |
2 3 4 |
describe('Utils:validate', () => { it('validUsername', () => { expect(validUsername('admin')).toBe(true) |
50760eab9 auto commit the c... |
5 |
expect(validUsername('assistant')).toBe(true) |
3d3cdb68f auto commit the c... |
6 |
expect(validUsername('runner')).toBe(true) |
50760eab9 auto commit the c... |
7 |
expect(validUsername('shoper')).toBe(true) |
3d3cdb68f auto commit the c... |
8 9 10 |
// expect(validUsername('xxxx')).toBe(false) // expect(validUsername('xxxx')).toBe(false) // expect(validUsername('xxxx')).toBe(false) |
80a28914e init |
11 |
}) |
d7d9c38c2 auto commit the c... |
12 |
it('validURL', () => { |
3d3cdb68f auto commit the c... |
13 14 15 |
// expect(validURL('https://github.com/PanJiaChen/vue-element-admin')).toBe(true) // expect(validURL('http://github.com/PanJiaChen/vue-element-admin')).toBe(true) // expect(validURL('github.com/PanJiaChen/vue-element-admin')).toBe(false) |
d7d9c38c2 auto commit the c... |
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
}) it('validLowerCase', () => { expect(validLowerCase('abc')).toBe(true) expect(validLowerCase('Abc')).toBe(false) expect(validLowerCase('123abc')).toBe(false) }) it('validUpperCase', () => { expect(validUpperCase('ABC')).toBe(true) expect(validUpperCase('Abc')).toBe(false) expect(validUpperCase('123ABC')).toBe(false) }) it('validAlphabets', () => { expect(validAlphabets('ABC')).toBe(true) expect(validAlphabets('Abc')).toBe(true) expect(validAlphabets('123aBC')).toBe(false) |
80a28914e init |
31 32 |
}) }) |