天波用户运营管理后台系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

validate.spec.js 703B

3 years ago
1234567891011121314151617
  1. import { validUsername, isExternal } from '@/utils/validate.js'
  2. describe('Utils:validate', () => {
  3. it('validUsername', () => {
  4. expect(validUsername('admin')).toBe(true)
  5. expect(validUsername('editor')).toBe(true)
  6. expect(validUsername('xxxx')).toBe(false)
  7. })
  8. it('isExternal', () => {
  9. expect(isExternal('https://github.com/PanJiaChen/vue-element-admin')).toBe(true)
  10. expect(isExternal('http://github.com/PanJiaChen/vue-element-admin')).toBe(true)
  11. expect(isExternal('github.com/PanJiaChen/vue-element-admin')).toBe(false)
  12. expect(isExternal('/dashboard')).toBe(false)
  13. expect(isExternal('./dashboard')).toBe(false)
  14. expect(isExternal('dashboard')).toBe(false)
  15. })
  16. })