File tree Expand file tree Collapse file tree 5 files changed +32
-4
lines changed
Expand file tree Collapse file tree 5 files changed +32
-4
lines changed Original file line number Diff line number Diff line change 11module . exports = {
2- // TODO: We should try to switch to the @vue /app preset, but right now it breaks everything
3- //presets: ['@vue/app'],
42 presets : [ '@vue/cli-plugin-babel/preset' ] ,
53 plugins : [ 'lodash' , '@babel/plugin-syntax-dynamic-import' ] ,
64 comments : false ,
Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ module.exports = {
2525 preset : 'ts-jest' ,
2626 testEnvironment : 'node' ,
2727 testMatch : [ '**/test/**/*.test.node.js?(x)' ] ,
28+ transform : {
29+ '^.+\\.js$' : 'babel-jest' ,
30+ '^.+\\.vue$' : 'vue-jest' ,
31+ } ,
2832 moduleNameMapper : {
2933 '^~/(.+)$' : '<rootDir>/src/$1' ,
3034 } ,
Original file line number Diff line number Diff line change 88 "scripts" : {
99 "serve" : " vue-cli-service serve" ,
1010 "build" : " vue-cli-service build" ,
11- "test" : " jest --rootDir=./ " ,
11+ "test" : " vue-cli-service test:unit " ,
1212 "test:unit" : " vue-cli-service test:unit" ,
1313 "test:e2e" : " vue-cli-service test:e2e" ,
1414 "lint" : " vue-cli-service lint" ,
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export const defaultCategories: Category[] = [
2424 {
2525 name : [ 'Work' ] ,
2626 rule : { type : 'regex' , regex : 'Google Docs|libreoffice|ReText' } ,
27- data : { productivity : 5 , color : '#0F0' } ,
27+ data : { color : '#0F0' } ,
2828 } ,
2929 {
3030 name : [ 'Work' , 'Programming' ] ,
Original file line number Diff line number Diff line change 1+ import store from '~/store' ;
2+
3+ test ( 'loads categories' , ( ) => {
4+ // Load categories
5+ expect ( store . state . categories . classes ) . toHaveLength ( 0 ) ;
6+ store . commit ( 'categories/restoreDefaultClasses' ) ;
7+ expect ( store . state . categories . classes_unsaved_changes ) . toBeTruthy ( ) ;
8+ store . commit ( 'categories/saveCompleted' ) ;
9+ expect ( store . state . categories . classes_unsaved_changes ) . toBeFalsy ( ) ;
10+ expect ( store . state . categories . classes ) . not . toHaveLength ( 0 ) ;
11+
12+ // Retrieve class
13+ let workCat = store . getters [ 'categories/get_category' ] ( [ 'Work' ] ) ;
14+ expect ( workCat ) . not . toBeUndefined ( ) ;
15+ workCat = JSON . parse ( JSON . stringify ( workCat ) ) ; // copy
16+
17+ // Modify class
18+ const newRegex = 'Just testing' ;
19+ workCat . rule . regex = newRegex ;
20+ store . commit ( 'categories/updateClass' , workCat ) ;
21+ expect ( store . getters [ 'categories/get_category' ] ( [ 'Work' ] ) . rule . regex ) . toEqual ( newRegex ) ;
22+
23+ // Check that getters behave somewhat
24+ expect ( store . getters [ 'categories/all_categories' ] ) . not . toHaveLength ( 0 ) ;
25+ expect ( store . getters [ 'categories/classes_hierarchy' ] ) . not . toHaveLength ( 0 ) ;
26+ } ) ;
You can’t perform that action at this time.
0 commit comments