Skip to content

Commit

Permalink
feat: jest support
Browse files Browse the repository at this point in the history
  • Loading branch information
asvae committed Jan 16, 2019
1 parent 2da40c6 commit 352dec1
Show file tree
Hide file tree
Showing 6 changed files with 1,603 additions and 39 deletions.
23 changes: 23 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
moduleFileExtensions: [
'js',
'jsx',
'json',
'vue'
],
transform: {
'^.+\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.jsx?$': 'babel-jest'
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
snapshotSerializers: [
'jest-serializer-vue'
],
testMatch: [
'**/src/**/*.spec.(js|jsx|ts|tsx)'
],
testURL: 'http://localhost/'
}
19 changes: 12 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
{
"name": "vuestic-admin",
"version": "1.9.0",
"private": false,
"description": "Vue.js admin template",
"author": "smartapant <[email protected]>",
"private": false,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"inspect": "vue-cli-service inspect > inspect.js"
},
"repository": {
"type": "git",
"url": "https://github.com/epicmaxco/vuestic-admin.git"
"inspect": "vue-cli-service inspect > inspect.js",
"test:unit": "vue-cli-service test:unit"
},
"license": "MIT",
"dependencies": {
"amcharts3": "^3.21.13",
"ammap3": "^3.21.13",
Expand Down Expand Up @@ -56,9 +52,13 @@
"devDependencies": {
"@vue/cli-plugin-babel": "^3.0.5",
"@vue/cli-plugin-eslint": "^3.0.5",
"@vue/cli-plugin-unit-jest": "^3.3.0",
"@vue/cli-service": "^3.0.5",
"@vue/eslint-config-standard": "^3.0.5",
"@vue/test-utils": "^1.0.0-beta.20",
"autoprefixer": "9.1.5",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "^23.6.0",
"chalk": "2.4.1",
"connect-history-api-fallback": "1.5.0",
"copy-webpack-plugin": "4.5.3",
Expand Down Expand Up @@ -88,6 +88,7 @@
"gitHooks": {
"pre-commit": "lint-staged"
},
"license": "MIT",
"lint-staged": {
"*.js": [
"vue-cli-service lint",
Expand All @@ -97,5 +98,9 @@
"vue-cli-service lint",
"git add"
]
},
"repository": {
"type": "git",
"url": "https://github.com/epicmaxco/vuestic-admin.git"
}
}
5 changes: 5 additions & 0 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
env: {
jest: true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { shallowMount } from '@vue/test-utils'
import VaCheckbox from './VuesticCheckbox'

describe('VaCheckbox', () => {
it('default', () => {
const wrapper = shallowMount(VaCheckbox, {
propsData: { value: false }
})
expect(wrapper.html()).toMatchSnapshot()
})
it('true value', () => {
const wrapper = shallowMount(VaCheckbox, {
propsData: { value: true }
})
expect(wrapper.html()).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`VaCheckbox default 1`] = `
<div class="vuestic-checkbox">
<div class="vuestic-checkbox__square"><input readonly="readonly" class="vuestic-checkbox__input"> <i aria-hidden="true" class="ion ion-md-checkmark vuestic-checkbox__icon-selected"></i></div>
<div class="vuestic-checkbox__label-text">
</div>
<!---->
</div>
`;
exports[`VaCheckbox true value 1`] = `
<div class="vuestic-checkbox vuestic-checkbox--selected">
<div class="vuestic-checkbox__square active"><input readonly="readonly" class="vuestic-checkbox__input"> <i aria-hidden="true" class="ion ion-md-checkmark vuestic-checkbox__icon-selected"></i></div>
<div class="vuestic-checkbox__label-text">
</div>
<!---->
</div>
`;
Loading

0 comments on commit 352dec1

Please sign in to comment.