File tree Expand file tree Collapse file tree 4 files changed +51
-1
lines changed Expand file tree Collapse file tree 4 files changed +51
-1
lines changed Original file line number Diff line number Diff line change 1+ version : 2.0
2+ workflows :
3+ version : 2
4+ build :
5+ jobs :
6+ - node10
7+ - node12
8+ jobs :
9+ node10 :
10+ working_directory : ~/react-hooks-shared-state
11+ docker :
12+ - image : node:10.15.3
13+ steps :
14+ - checkout
15+ - run : npm install
16+ - run : npm test
17+
18+ node12 :
19+ working_directory : ~/react-hooks-shared-state
20+ docker :
21+ - image : node:12.1.0
22+ steps :
23+ - checkout
24+ - run : npm install
25+ - run : npm test
Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` setState() is assign state and call setters. 1` ] = `
4+ Object {
5+ " test" : true ,
6+ }
7+ ` ;
Original file line number Diff line number Diff line change 1+ const SharedState = require ( '../../lib/shared-state' ) ;
2+
3+ test ( 'setState() is assign state and call setters.' , ( ) => {
4+ const shareState = new SharedState ( ) ;
5+ shareState . setters = [
6+ {
7+ path : 'test' ,
8+ set : jest . fn ( )
9+ } ,
10+ {
11+ set : jest . fn ( )
12+ }
13+ ] ;
14+ shareState . setState ( { test : true } ) ;
15+ expect ( shareState . state ) . toMatchSnapshot ( ) ;
16+ expect ( shareState . setters [ 0 ] . set ) . toBeCalledWith ( true ) ;
17+ expect ( shareState . setters [ 1 ] . set ) . toBeCalledWith ( { test : true } ) ;
18+ } ) ;
Original file line number Diff line number Diff line change 66 "scripts" : {
77 "start" : " ./node_modules/webpack-dev-server/bin/webpack-dev-server.js" ,
88 "build" : " ./node_modules/webpack/bin/webpack.js --env.mode=production" ,
9- "test" : " echo \" Error: no test specified \" && exit 1 " ,
9+ "test" : " ./node_modules/jest/bin/jest.js --coverage " ,
1010 "ncu" : " ./node_modules/npm-check-updates/bin/ncu"
1111 },
1212 "repository" : {
You can’t perform that action at this time.
0 commit comments