@@ -84,7 +84,7 @@ describe('Test function types', () => {
84
84
const [ context , Provider ] = createContextState ( 'empty state' , {
85
85
action : ( reference ) => {
86
86
expect ( reference ) . toHaveProperty ( 'setState' )
87
- expect ( reference ) . toHaveProperty ( 'useContext ' )
87
+ expect ( reference ) . toHaveProperty ( 'state ' )
88
88
verify ( )
89
89
}
90
90
} )
@@ -109,21 +109,23 @@ describe('Test function types', () => {
109
109
expect ( setState ) . toBeInstanceOf ( Function )
110
110
verify ( )
111
111
} ,
112
- action2 : ( { useContext } ) => {
113
- expect ( useContext ) . toBeInstanceOf ( Function )
112
+ /*
113
+ action2: ({ state }) => {
114
+ expect(typeof state).toBeInstanceOf(Function)
114
115
verify()
115
116
},
117
+ */ // TODO: add this test
116
118
} )
117
119
118
120
const Consumer : React . FC = props => {
119
121
const store = React . useContext ( context )
120
122
store . action1 ( )
121
- store . action2 ( )
123
+ // store.action2()
122
124
return < div />
123
125
}
124
126
125
127
mount ( < Provider > < Consumer /> </ Provider > )
126
- expect ( verify . mock . calls . length ) . toBe ( 2 )
128
+ expect ( verify . mock . calls . length ) . toBe ( 1 )
127
129
} )
128
130
129
131
it ( 'can provide arguments to action' , ( ) => {
@@ -237,8 +239,8 @@ describe('Logic', () => {
237
239
} )
238
240
239
241
const [ context2 , Provider2 ] = createContextState ( { state2 : 'before' } , {
240
- action2 : ( { useContext } ) => {
241
- const store = useContext ( context1 )
242
+ action2 : ( _ ) => {
243
+ const store = React . useContext ( context1 )
242
244
return store . action1 ( )
243
245
} ,
244
246
} )
0 commit comments