@@ -7,23 +7,23 @@ import { NULL_OBJECT } from '../../nullObjects';
7
7
describe ( 'streamsReducer' , ( ) => {
8
8
describe ( 'ACCOUNT_SWITCH' , ( ) => {
9
9
test ( 'resets state to initial state' , ( ) => {
10
- const initialState = deepFreeze ( [ { max_id : 1 , name : 'some_topic' } ] ) ;
10
+ const prevState = deepFreeze ( [ { max_id : 1 , name : 'some_topic' } ] ) ;
11
11
12
12
const action = deepFreeze ( {
13
13
type : ACCOUNT_SWITCH ,
14
14
} ) ;
15
15
16
16
const expectedState = NULL_OBJECT ;
17
17
18
- const actualState = topicsReducer ( initialState , action ) ;
18
+ const actualState = topicsReducer ( prevState , action ) ;
19
19
20
20
expect ( actualState ) . toEqual ( expectedState ) ;
21
21
} ) ;
22
22
} ) ;
23
23
24
24
describe ( 'INIT_TOPICS' , ( ) => {
25
25
test ( 'adds new topics mapped to stream id' , ( ) => {
26
- const initialState = NULL_OBJECT ;
26
+ const prevState = NULL_OBJECT ;
27
27
28
28
const action = deepFreeze ( {
29
29
type : INIT_TOPICS ,
@@ -53,13 +53,13 @@ describe('streamsReducer', () => {
53
53
] ,
54
54
} ;
55
55
56
- const newState = topicsReducer ( initialState , action ) ;
56
+ const newState = topicsReducer ( prevState , action ) ;
57
57
58
58
expect ( newState ) . toEqual ( expectedState ) ;
59
59
} ) ;
60
60
61
61
test ( 'if topics for stream already exist, replace them' , ( ) => {
62
- const initialState = deepFreeze ( {
62
+ const prevState = deepFreeze ( {
63
63
'1' : [
64
64
{
65
65
max_id : 1 ,
@@ -96,15 +96,15 @@ describe('streamsReducer', () => {
96
96
] ,
97
97
} ;
98
98
99
- const newState = topicsReducer ( initialState , action ) ;
99
+ const newState = topicsReducer ( prevState , action ) ;
100
100
101
101
expect ( newState ) . toEqual ( expectedState ) ;
102
102
} ) ;
103
103
} ) ;
104
104
105
105
describe ( 'EVENT_NEW_MESSAGE' , ( ) => {
106
106
test ( 'if message is not in stream do not change state' , ( ) => {
107
- const initialState = NULL_OBJECT ;
107
+ const prevState = NULL_OBJECT ;
108
108
109
109
const action = {
110
110
type : EVENT_NEW_MESSAGE ,
@@ -115,13 +115,13 @@ describe('streamsReducer', () => {
115
115
} ,
116
116
} ;
117
117
118
- const actualState = topicsReducer ( initialState , action ) ;
118
+ const actualState = topicsReducer ( prevState , action ) ;
119
119
120
- expect ( actualState ) . toBe ( initialState ) ;
120
+ expect ( actualState ) . toBe ( prevState ) ;
121
121
} ) ;
122
122
123
123
test ( 'if stream message and topic exists update with latest message id' , ( ) => {
124
- const initialState = {
124
+ const prevState = {
125
125
123 : [
126
126
{
127
127
max_id : 1 ,
@@ -149,13 +149,13 @@ describe('streamsReducer', () => {
149
149
] ,
150
150
} ;
151
151
152
- const actualState = topicsReducer ( initialState , action ) ;
152
+ const actualState = topicsReducer ( prevState , action ) ;
153
153
154
154
expect ( actualState ) . toEqual ( expectedState ) ;
155
155
} ) ;
156
156
157
157
test ( 'if stream message and topic does not exist, add it' , ( ) => {
158
- const initialState = NULL_OBJECT ;
158
+ const prevState = NULL_OBJECT ;
159
159
160
160
const action = deepFreeze ( {
161
161
type : EVENT_NEW_MESSAGE ,
@@ -176,7 +176,7 @@ describe('streamsReducer', () => {
176
176
] ,
177
177
} ;
178
178
179
- const actualState = topicsReducer ( initialState , action ) ;
179
+ const actualState = topicsReducer ( prevState , action ) ;
180
180
181
181
expect ( actualState ) . toEqual ( expectedState ) ;
182
182
} ) ;
0 commit comments