@@ -27,8 +27,11 @@ describe('sessionReducer', () => {
27
27
// global
28
28
{ type : GOT_PUSH_TOKEN , pushToken : '456' } ,
29
29
{ type : APP_ORIENTATION , orientation : 'LANDSCAPE' } ,
30
- ] . reduce ( sessionReducer , eg . baseReduxState . session ) ;
31
- expect ( sessionReducer ( prevState , eg . action . reset_account_data ) ) . toEqual ( {
30
+ ] . reduce (
31
+ ( state , action ) => sessionReducer ( state , action , eg . plusReduxState ) ,
32
+ eg . baseReduxState . session ,
33
+ ) ;
34
+ expect ( sessionReducer ( prevState , eg . action . reset_account_data , eg . plusReduxState ) ) . toEqual ( {
32
35
...prevState ,
33
36
...initialPerAccountSessionState ,
34
37
} ) ;
@@ -37,14 +40,14 @@ describe('sessionReducer', () => {
37
40
38
41
test ( 'DEAD_QUEUE' , ( ) => {
39
42
const state = deepFreeze ( { ...baseState , loading : true } ) ;
40
- const newState = sessionReducer ( state , deepFreeze ( { type : DEAD_QUEUE } ) ) ;
43
+ const newState = sessionReducer ( state , deepFreeze ( { type : DEAD_QUEUE } ) , eg . plusReduxState ) ;
41
44
expect ( newState ) . toEqual ( { ...baseState , loading : false } ) ;
42
45
} ) ;
43
46
44
47
test ( 'REGISTER_COMPLETE' , ( ) => {
45
48
const state = deepFreeze ( { ...baseState , loading : true } ) ;
46
49
const action = eg . mkActionRegisterComplete ( { queue_id : '100' } ) ;
47
- const newState = sessionReducer ( state , action ) ;
50
+ const newState = sessionReducer ( state , action , eg . plusReduxState ) ;
48
51
expect ( newState ) . toEqual ( {
49
52
...baseState ,
50
53
loading : false ,
@@ -55,45 +58,56 @@ describe('sessionReducer', () => {
55
58
test ( 'APP_ONLINE' , ( ) => {
56
59
const state = deepFreeze ( { ...baseState , isOnline : false } ) ;
57
60
const action = deepFreeze ( { type : APP_ONLINE , isOnline : true } ) ;
58
- const newState = sessionReducer ( state , action ) ;
61
+ const newState = sessionReducer ( state , action , eg . plusReduxState ) ;
59
62
expect ( newState ) . toEqual ( { ...baseState , isOnline : true } ) ;
60
63
} ) ;
61
64
62
65
test ( 'REGISTER_ABORT' , ( ) => {
63
66
const state = deepFreeze ( { ...baseState , loading : true } ) ;
64
- const newState = sessionReducer ( state , deepFreeze ( { type : REGISTER_ABORT , reason : 'server' } ) ) ;
67
+ const newState = sessionReducer (
68
+ state ,
69
+ deepFreeze ( { type : REGISTER_ABORT , reason : 'server' } ) ,
70
+ eg . plusReduxState ,
71
+ ) ;
65
72
expect ( newState ) . toEqual ( { ...baseState , loading : false } ) ;
66
73
} ) ;
67
74
68
75
test ( 'REGISTER_START' , ( ) => {
69
76
const state = deepFreeze ( { ...baseState , loading : false } ) ;
70
- const newState = sessionReducer ( state , deepFreeze ( { type : REGISTER_START } ) ) ;
77
+ const newState = sessionReducer ( state , deepFreeze ( { type : REGISTER_START } ) , eg . plusReduxState ) ;
71
78
expect ( newState ) . toEqual ( { ...baseState , loading : true } ) ;
72
79
} ) ;
73
80
74
81
test ( 'APP_ORIENTATION' , ( ) => {
75
82
const state = deepFreeze ( { ...baseState , orientation : 'PORTRAIT' } ) ;
76
83
const orientation = 'LANDSCAPE' ;
77
84
const action = deepFreeze ( { type : APP_ORIENTATION , orientation } ) ;
78
- expect ( sessionReducer ( state , action ) ) . toEqual ( { ...baseState , orientation } ) ;
85
+ expect ( sessionReducer ( state , action , eg . plusReduxState ) ) . toEqual ( { ...baseState , orientation } ) ;
79
86
} ) ;
80
87
81
88
test ( 'GOT_PUSH_TOKEN' , ( ) => {
82
89
const pushToken = 'pushToken' ;
83
90
const action = deepFreeze ( { type : GOT_PUSH_TOKEN , pushToken } ) ;
84
- expect ( sessionReducer ( baseState , action ) ) . toEqual ( { ...baseState , pushToken } ) ;
91
+ expect ( sessionReducer ( baseState , action , eg . plusReduxState ) ) . toEqual ( {
92
+ ...baseState ,
93
+ pushToken,
94
+ } ) ;
85
95
} ) ;
86
96
87
97
test ( 'TOGGLE_OUTBOX_SENDING' , ( ) => {
88
98
const state = deepFreeze ( { ...baseState , outboxSending : false } ) ;
89
99
expect (
90
- sessionReducer ( state , deepFreeze ( { type : TOGGLE_OUTBOX_SENDING , sending : true } ) ) ,
100
+ sessionReducer (
101
+ state ,
102
+ deepFreeze ( { type : TOGGLE_OUTBOX_SENDING , sending : true } ) ,
103
+ eg . plusReduxState ,
104
+ ) ,
91
105
) . toEqual ( { ...baseState , outboxSending : true } ) ;
92
106
} ) ;
93
107
94
108
test ( 'DISMISS_SERVER_COMPAT_NOTICE' , ( ) => {
95
109
const action = deepFreeze ( { type : DISMISS_SERVER_COMPAT_NOTICE } ) ;
96
- expect ( sessionReducer ( baseState , action ) ) . toEqual ( {
110
+ expect ( sessionReducer ( baseState , action , eg . plusReduxState ) ) . toEqual ( {
97
111
...baseState ,
98
112
hasDismissedServerCompatNotice : true ,
99
113
} ) ;
0 commit comments