@@ -25,7 +25,7 @@ describe('fetchingReducer', () => {
25
25
26
26
describe ( 'MESSAGE_FETCH_START' , ( ) => {
27
27
test ( 'if messages are fetched before or after the corresponding flag is set' , ( ) => {
28
- const initialState = deepFreeze ( {
28
+ const prevState = deepFreeze ( {
29
29
[ HOME_NARROW_STR ] : { older : false , newer : false } ,
30
30
} ) ;
31
31
@@ -40,13 +40,13 @@ describe('fetchingReducer', () => {
40
40
[ HOME_NARROW_STR ] : { older : true , newer : true } ,
41
41
} ;
42
42
43
- const newState = fetchingReducer ( initialState , action ) ;
43
+ const newState = fetchingReducer ( prevState , action ) ;
44
44
45
45
expect ( newState ) . toEqual ( expectedState ) ;
46
46
} ) ;
47
47
48
48
test ( 'if key for narrow does not exist, it is created and corresponding flags are set' , ( ) => {
49
- const initialState = deepFreeze ( {
49
+ const prevState = deepFreeze ( {
50
50
[ HOME_NARROW_STR ] : { older : false , newer : false } ,
51
51
} ) ;
52
52
@@ -63,13 +63,13 @@ describe('fetchingReducer', () => {
63
63
[ keyFromNarrow ( narrow ) ] : { older : true , newer : false } ,
64
64
} ;
65
65
66
- const newState = fetchingReducer ( initialState , action ) ;
66
+ const newState = fetchingReducer ( prevState , action ) ;
67
67
68
68
expect ( newState ) . toEqual ( expectedState ) ;
69
69
} ) ;
70
70
71
71
test ( 'if fetching for a search narrow, ignore' , ( ) => {
72
- const initialState = deepFreeze ( {
72
+ const prevState = deepFreeze ( {
73
73
[ HOME_NARROW_STR ] : {
74
74
older : false ,
75
75
newer : false ,
@@ -81,24 +81,24 @@ describe('fetchingReducer', () => {
81
81
narrow : SEARCH_NARROW ( 'some query' ) ,
82
82
} ) ;
83
83
84
- const newState = fetchingReducer ( initialState , action ) ;
84
+ const newState = fetchingReducer ( prevState , action ) ;
85
85
86
- expect ( newState ) . toEqual ( initialState ) ;
86
+ expect ( newState ) . toEqual ( prevState ) ;
87
87
} ) ;
88
88
} ) ;
89
89
90
90
describe ( 'MESSAGE_FETCH_ERROR' , ( ) => {
91
91
test ( 'reverses the effect of MESSAGE_FETCH_START as much as possible' , ( ) => {
92
92
// As of the addition of this test, that means setting
93
93
// DEFAULT_FETCHING as the key.
94
- const initialState = deepFreeze ( { } ) ;
94
+ const state0 = deepFreeze ( { } ) ;
95
95
96
96
const messageFetchStartAction = deepFreeze ( {
97
97
...eg . action . message_fetch_start ,
98
98
narrow : HOME_NARROW ,
99
99
} ) ;
100
100
101
- const state1 = fetchingReducer ( initialState , messageFetchStartAction ) ;
101
+ const state1 = fetchingReducer ( state0 , messageFetchStartAction ) ;
102
102
103
103
const messageFetchErrorAction = deepFreeze ( {
104
104
type : MESSAGE_FETCH_ERROR ,
@@ -118,7 +118,7 @@ describe('fetchingReducer', () => {
118
118
119
119
describe ( 'MESSAGE_FETCH_COMPLETE' , ( ) => {
120
120
test ( 'sets corresponding fetching flags to false, if messages are received before or after' , ( ) => {
121
- const initialState = deepFreeze ( {
121
+ const prevState = deepFreeze ( {
122
122
[ HOME_NARROW_STR ] : { older : true , newer : true } ,
123
123
} ) ;
124
124
@@ -133,14 +133,14 @@ describe('fetchingReducer', () => {
133
133
[ HOME_NARROW_STR ] : { older : false , newer : true } ,
134
134
} ;
135
135
136
- const newState = fetchingReducer ( initialState , action ) ;
136
+ const newState = fetchingReducer ( prevState , action ) ;
137
137
138
138
expect ( newState ) . toEqual ( expectedState ) ;
139
139
} ) ;
140
140
} ) ;
141
141
142
142
test ( 'if fetched messages are from a search narrow, ignore them' , ( ) => {
143
- const initialState = deepFreeze ( {
143
+ const prevState = deepFreeze ( {
144
144
[ HOME_NARROW_STR ] : { older : true , newer : true } ,
145
145
} ) ;
146
146
@@ -149,8 +149,8 @@ describe('fetchingReducer', () => {
149
149
narrow : SEARCH_NARROW ( 'some query' ) ,
150
150
} ) ;
151
151
152
- const newState = fetchingReducer ( initialState , action ) ;
152
+ const newState = fetchingReducer ( prevState , action ) ;
153
153
154
- expect ( newState ) . toEqual ( initialState ) ;
154
+ expect ( newState ) . toEqual ( prevState ) ;
155
155
} ) ;
156
156
} ) ;
0 commit comments