From 1dfea3b28799305b2e35473e63477fcfccc47c31 Mon Sep 17 00:00:00 2001 From: Pan Date: Mon, 11 Mar 2019 14:41:20 +0800 Subject: [PATCH] fix jest test case --- jest.config.js | 6 +++--- tests/unit/utils/validate.spec.js | 34 +++++++++++++++---------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/jest.config.js b/jest.config.js index 1ce813e1..f5a99474 100644 --- a/jest.config.js +++ b/jest.config.js @@ -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', diff --git a/tests/unit/utils/validate.spec.js b/tests/unit/utils/validate.spec.js index b7d21922..ef2efe61 100644 --- a/tests/unit/utils/validate.spec.js +++ b/tests/unit/utils/validate.spec.js @@ -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) }) })