Skip to content

Commit 7640aa0

Browse files
chrisbobbegnprice
authored andcommitted
topics tests [nfc]: s/initialState/prevState/
1 parent 5b9d51d commit 7640aa0

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/topics/__tests__/topicsReducer-test.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,23 @@ import { NULL_OBJECT } from '../../nullObjects';
77
describe('streamsReducer', () => {
88
describe('ACCOUNT_SWITCH', () => {
99
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' }]);
1111

1212
const action = deepFreeze({
1313
type: ACCOUNT_SWITCH,
1414
});
1515

1616
const expectedState = NULL_OBJECT;
1717

18-
const actualState = topicsReducer(initialState, action);
18+
const actualState = topicsReducer(prevState, action);
1919

2020
expect(actualState).toEqual(expectedState);
2121
});
2222
});
2323

2424
describe('INIT_TOPICS', () => {
2525
test('adds new topics mapped to stream id', () => {
26-
const initialState = NULL_OBJECT;
26+
const prevState = NULL_OBJECT;
2727

2828
const action = deepFreeze({
2929
type: INIT_TOPICS,
@@ -53,13 +53,13 @@ describe('streamsReducer', () => {
5353
],
5454
};
5555

56-
const newState = topicsReducer(initialState, action);
56+
const newState = topicsReducer(prevState, action);
5757

5858
expect(newState).toEqual(expectedState);
5959
});
6060

6161
test('if topics for stream already exist, replace them', () => {
62-
const initialState = deepFreeze({
62+
const prevState = deepFreeze({
6363
'1': [
6464
{
6565
max_id: 1,
@@ -96,15 +96,15 @@ describe('streamsReducer', () => {
9696
],
9797
};
9898

99-
const newState = topicsReducer(initialState, action);
99+
const newState = topicsReducer(prevState, action);
100100

101101
expect(newState).toEqual(expectedState);
102102
});
103103
});
104104

105105
describe('EVENT_NEW_MESSAGE', () => {
106106
test('if message is not in stream do not change state', () => {
107-
const initialState = NULL_OBJECT;
107+
const prevState = NULL_OBJECT;
108108

109109
const action = {
110110
type: EVENT_NEW_MESSAGE,
@@ -115,13 +115,13 @@ describe('streamsReducer', () => {
115115
},
116116
};
117117

118-
const actualState = topicsReducer(initialState, action);
118+
const actualState = topicsReducer(prevState, action);
119119

120-
expect(actualState).toBe(initialState);
120+
expect(actualState).toBe(prevState);
121121
});
122122

123123
test('if stream message and topic exists update with latest message id', () => {
124-
const initialState = {
124+
const prevState = {
125125
123: [
126126
{
127127
max_id: 1,
@@ -149,13 +149,13 @@ describe('streamsReducer', () => {
149149
],
150150
};
151151

152-
const actualState = topicsReducer(initialState, action);
152+
const actualState = topicsReducer(prevState, action);
153153

154154
expect(actualState).toEqual(expectedState);
155155
});
156156

157157
test('if stream message and topic does not exist, add it', () => {
158-
const initialState = NULL_OBJECT;
158+
const prevState = NULL_OBJECT;
159159

160160
const action = deepFreeze({
161161
type: EVENT_NEW_MESSAGE,
@@ -176,7 +176,7 @@ describe('streamsReducer', () => {
176176
],
177177
};
178178

179-
const actualState = topicsReducer(initialState, action);
179+
const actualState = topicsReducer(prevState, action);
180180

181181
expect(actualState).toEqual(expectedState);
182182
});

0 commit comments

Comments
 (0)