liweilong
2020-12-25 57fedb8aa042c9f8bf5a3214b455144436850f1f
提交 | 用户 | 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 })