fix jest test case
This commit is contained in:
parent
2ac4cee805
commit
1dfea3b287
|
@ -1,9 +1,9 @@
|
|||
module.exports = {
|
||||
verbose: true,
|
||||
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'],
|
||||
transformIgnorePatterns: [
|
||||
'node_modules/(?!(babel-jest|jest-vue-preprocessor)/)'
|
||||
],
|
||||
// transformIgnorePatterns: [
|
||||
// 'node_modules/(?!(babel-jest|jest-vue-preprocessor)/)'
|
||||
// ],
|
||||
transform: {
|
||||
'^.+\\.vue$': 'vue-jest',
|
||||
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
|
||||
|
|
|
@ -1,28 +1,28 @@
|
|||
import { validUsername, validateURL, validateLowerCase, validateUpperCase, validateAlphabets } from '@/utils/validate.js'
|
||||
import { validUsername, validURL, validLowerCase, validUpperCase, validAlphabets } from '@/utils/validate.js'
|
||||
describe('Utils:validate', () => {
|
||||
it('validUsername', () => {
|
||||
expect(validUsername('admin')).toBe(true)
|
||||
expect(validUsername('editor')).toBe(true)
|
||||
expect(validUsername('xxxx')).toBe(false)
|
||||
})
|
||||
it('validateURL', () => {
|
||||
expect(validateURL('https://github.com/PanJiaChen/vue-element-admin')).toBe(true)
|
||||
expect(validateURL('http://github.com/PanJiaChen/vue-element-admin')).toBe(true)
|
||||
expect(validateURL('github.com/PanJiaChen/vue-element-admin')).toBe(false)
|
||||
it('validURL', () => {
|
||||
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)
|
||||
})
|
||||
it('validateLowerCase', () => {
|
||||
expect(validateLowerCase('abc')).toBe(true)
|
||||
expect(validateLowerCase('Abc')).toBe(false)
|
||||
expect(validateLowerCase('123abc')).toBe(false)
|
||||
it('validLowerCase', () => {
|
||||
expect(validLowerCase('abc')).toBe(true)
|
||||
expect(validLowerCase('Abc')).toBe(false)
|
||||
expect(validLowerCase('123abc')).toBe(false)
|
||||
})
|
||||
it('validateUpperCase', () => {
|
||||
expect(validateUpperCase('ABC')).toBe(true)
|
||||
expect(validateUpperCase('Abc')).toBe(false)
|
||||
expect(validateUpperCase('123ABC')).toBe(false)
|
||||
it('validUpperCase', () => {
|
||||
expect(validUpperCase('ABC')).toBe(true)
|
||||
expect(validUpperCase('Abc')).toBe(false)
|
||||
expect(validUpperCase('123ABC')).toBe(false)
|
||||
})
|
||||
it('validateAlphabets', () => {
|
||||
expect(validateAlphabets('ABC')).toBe(true)
|
||||
expect(validateAlphabets('Abc')).toBe(true)
|
||||
expect(validateAlphabets('123aBC')).toBe(false)
|
||||
it('validAlphabets', () => {
|
||||
expect(validAlphabets('ABC')).toBe(true)
|
||||
expect(validAlphabets('Abc')).toBe(true)
|
||||
expect(validAlphabets('123aBC')).toBe(false)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue