File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ import useState from '../useState' ;
2
+ import renderHook from '../util/renderHook' ;
3
+
4
+ describe ( 'useState' , ( ) => {
5
+ it ( 'should be defined' , ( ) => {
6
+ expect ( useState ) . toBeDefined ( ) ;
7
+ } ) ;
8
+
9
+ it ( 'should update state' , ( ) => {
10
+ type Inject = { count1 : number ; count2 : number } ;
11
+ const { vm } = renderHook < Inject > ( ( ) => ( {
12
+ ...useState ( { count1 : 'count' } ) ,
13
+ ...useState ( 'test' , { count2 : 'count' } ) ,
14
+ } ) ) ;
15
+ expect ( vm . count1 ) . toBe ( 0 ) ;
16
+ expect ( vm . count2 ) . toBe ( 0 ) ;
17
+
18
+ vm . $store . commit ( 'increment' ) ;
19
+ vm . $store . commit ( 'test/decrement' ) ;
20
+
21
+ expect ( vm . count1 ) . toBe ( 1 ) ;
22
+ expect ( vm . count2 ) . toBe ( - 1 ) ;
23
+ } ) ;
24
+ } ) ;
Original file line number Diff line number Diff line change
1
+ import createVuexHelper , { Helper } from './util/helpers' ;
2
+
3
+ export default createVuexHelper ( Helper . State ) ;
You can’t perform that action at this time.
0 commit comments