File tree 1 file changed +37
-0
lines changed 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { INCREMENT_COUNTER , DECREMENT_COUNTER } from './actionTypes'
2
+ import counterReducer from './counterReducer'
3
+ import { CounterActionTypes } from './types'
4
+
5
+ describe ( 'features > counter > counterReducer' , ( ) => {
6
+ it ( `increments value, if ${ INCREMENT_COUNTER } action is provided` , ( ) => {
7
+ const initialState = {
8
+ value : 0 ,
9
+ }
10
+
11
+ const expectedState = {
12
+ value : 1 ,
13
+ }
14
+
15
+ const action : CounterActionTypes = {
16
+ type : INCREMENT_COUNTER ,
17
+ }
18
+
19
+ expect ( counterReducer ( initialState , action ) ) . toEqual ( expectedState )
20
+ } )
21
+
22
+ it ( `increments value, if ${ DECREMENT_COUNTER } action is provided` , ( ) => {
23
+ const initialState = {
24
+ value : 0 ,
25
+ }
26
+
27
+ const expectedState = {
28
+ value : - 1 ,
29
+ }
30
+
31
+ const action : CounterActionTypes = {
32
+ type : DECREMENT_COUNTER ,
33
+ }
34
+
35
+ expect ( counterReducer ( initialState , action ) ) . toEqual ( expectedState )
36
+ } )
37
+ } )
You can’t perform that action at this time.
0 commit comments