children117cl
2021-06-03 8410b536a5f7cd16b5d8dcd86b28b6a283437626
提交 | 用户 | age
2a61f6 1 import { validUsername, isExternal } from '@/utils/validate.js'
L 2
3 describe('Utils:validate', () => {
4   it('validUsername', () => {
5     expect(validUsername('admin')).toBe(true)
6     expect(validUsername('editor')).toBe(true)
7     expect(validUsername('xxxx')).toBe(false)
8   })
9   it('isExternal', () => {
10     expect(isExternal('https://github.com/PanJiaChen/vue-element-admin')).toBe(true)
11     expect(isExternal('http://github.com/PanJiaChen/vue-element-admin')).toBe(true)
12     expect(isExternal('github.com/PanJiaChen/vue-element-admin')).toBe(false)
13     expect(isExternal('/dashboard')).toBe(false)
14     expect(isExternal('./dashboard')).toBe(false)
15     expect(isExternal('dashboard')).toBe(false)
16   })
17 })