小说后台管理系统
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

validate.spec.js 1.1 KiB

12345678910111213141516171819202122232425262728
  1. import { validUsername, validURL, validLowerCase, validUpperCase, validAlphabets } 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('validURL', () => {
  9. expect(validURL('https://github.com/PanJiaChen/vue-element-admin')).toBe(true)
  10. expect(validURL('http://github.com/PanJiaChen/vue-element-admin')).toBe(true)
  11. expect(validURL('github.com/PanJiaChen/vue-element-admin')).toBe(false)
  12. })
  13. it('validLowerCase', () => {
  14. expect(validLowerCase('abc')).toBe(true)
  15. expect(validLowerCase('Abc')).toBe(false)
  16. expect(validLowerCase('123abc')).toBe(false)
  17. })
  18. it('validUpperCase', () => {
  19. expect(validUpperCase('ABC')).toBe(true)
  20. expect(validUpperCase('Abc')).toBe(false)
  21. expect(validUpperCase('123ABC')).toBe(false)
  22. })
  23. it('validAlphabets', () => {
  24. expect(validAlphabets('ABC')).toBe(true)
  25. expect(validAlphabets('Abc')).toBe(true)
  26. expect(validAlphabets('123aBC')).toBe(false)
  27. })
  28. })