Skip to content

Commit 22dab8f

Browse files
committed
user groups tests [nfc]: s/initialState/prevState/
1 parent e7278d2 commit 22dab8f

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

src/user-groups/__tests__/userGroupsReducer-test.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import userGroupsReducer from '../userGroupsReducer';
1414
describe('userGroupsReducer', () => {
1515
describe('REGISTER_COMPLETE', () => {
1616
test('when data is provided init state with it', () => {
17-
const initialState = deepFreeze([]);
17+
const prevState = deepFreeze([]);
1818
const action = deepFreeze({
1919
type: REGISTER_COMPLETE,
2020
data: {
@@ -28,7 +28,7 @@ describe('userGroupsReducer', () => {
2828
},
2929
});
3030

31-
const actualState = userGroupsReducer(initialState, action);
31+
const actualState = userGroupsReducer(prevState, action);
3232

3333
expect(actualState).toEqual([
3434
{
@@ -40,22 +40,22 @@ describe('userGroupsReducer', () => {
4040
});
4141

4242
test('when no data is given reset state', () => {
43-
const initialState = deepFreeze([['stream'], ['topic']]);
43+
const prevState = deepFreeze([['stream'], ['topic']]);
4444
const action = deepFreeze({
4545
type: REGISTER_COMPLETE,
4646
data: {},
4747
});
4848
const expectedState = [];
4949

50-
const actualState = userGroupsReducer(initialState, action);
50+
const actualState = userGroupsReducer(prevState, action);
5151

5252
expect(actualState).toEqual(expectedState);
5353
});
5454
});
5555

5656
describe('ACCOUNT_SWITCH', () => {
5757
test('resets state to initial state', () => {
58-
const initialState = deepFreeze([
58+
const prevState = deepFreeze([
5959
{
6060
id: 1,
6161
name: 'Some Group',
@@ -70,15 +70,15 @@ describe('userGroupsReducer', () => {
7070

7171
const expectedState = [];
7272

73-
const actualState = userGroupsReducer(initialState, action);
73+
const actualState = userGroupsReducer(prevState, action);
7474

7575
expect(actualState).toEqual(expectedState);
7676
});
7777
});
7878

7979
describe('EVENT_USER_GROUP_ADD', () => {
8080
test('adds a user group to the state', () => {
81-
const initialState = deepFreeze([]);
81+
const prevState = deepFreeze([]);
8282
const group = {
8383
id: 1,
8484
name: 'Some Group',
@@ -93,29 +93,29 @@ describe('userGroupsReducer', () => {
9393

9494
const expectedState = [group];
9595

96-
const actualState = userGroupsReducer(initialState, action);
96+
const actualState = userGroupsReducer(prevState, action);
9797

9898
expect(actualState).toEqual(expectedState);
9999
});
100100
});
101101

102102
describe('EVENT_USER_GROUP_REMOVE', () => {
103103
test('if user group does not exist state does not change', () => {
104-
const initialState = deepFreeze([]);
104+
const prevState = deepFreeze([]);
105105
const action = deepFreeze({
106106
type: EVENT_USER_GROUP_REMOVE,
107107
op: 'remove',
108108
group_id: 1,
109109
});
110110
const expectedState = [];
111111

112-
const actualState = userGroupsReducer(initialState, action);
112+
const actualState = userGroupsReducer(prevState, action);
113113

114114
expect(actualState).toEqual(expectedState);
115115
});
116116

117117
test('adds a user group to the state', () => {
118-
const initialState = deepFreeze([
118+
const prevState = deepFreeze([
119119
{
120120
id: 1,
121121
name: 'Some group',
@@ -138,15 +138,15 @@ describe('userGroupsReducer', () => {
138138
},
139139
];
140140

141-
const actualState = userGroupsReducer(initialState, action);
141+
const actualState = userGroupsReducer(prevState, action);
142142

143143
expect(actualState).toEqual(expectedState);
144144
});
145145
});
146146

147147
describe('EVENT_USER_GROUP_UPDATE', () => {
148148
test('if user group does not exist state does not change', () => {
149-
const initialState = deepFreeze([]);
149+
const prevState = deepFreeze([]);
150150
const action = deepFreeze({
151151
type: EVENT_USER_GROUP_UPDATE,
152152
op: 'update',
@@ -155,13 +155,13 @@ describe('userGroupsReducer', () => {
155155
});
156156
const expectedState = [];
157157

158-
const actualState = userGroupsReducer(initialState, action);
158+
const actualState = userGroupsReducer(prevState, action);
159159

160160
expect(actualState).toEqual(expectedState);
161161
});
162162

163163
test('updates an existing user group with supplied new values', () => {
164-
const initialState = deepFreeze([
164+
const prevState = deepFreeze([
165165
{
166166
id: 1,
167167
name: 'Some group',
@@ -188,15 +188,15 @@ describe('userGroupsReducer', () => {
188188
},
189189
];
190190

191-
const actualState = userGroupsReducer(initialState, action);
191+
const actualState = userGroupsReducer(prevState, action);
192192

193193
expect(actualState).toEqual(expectedState);
194194
});
195195
});
196196

197197
describe('EVENT_USER_GROUP_ADD_MEMBERS', () => {
198198
test('if user group does not exist state does not change', () => {
199-
const initialState = deepFreeze([]);
199+
const prevState = deepFreeze([]);
200200
const action = deepFreeze({
201201
type: EVENT_USER_GROUP_ADD_MEMBERS,
202202
op: 'add_members',
@@ -205,13 +205,13 @@ describe('userGroupsReducer', () => {
205205
});
206206
const expectedState = [];
207207

208-
const actualState = userGroupsReducer(initialState, action);
208+
const actualState = userGroupsReducer(prevState, action);
209209

210210
expect(actualState).toEqual(expectedState);
211211
});
212212

213213
test('updates an existing user group with supplied new members', () => {
214-
const initialState = deepFreeze([
214+
const prevState = deepFreeze([
215215
{
216216
id: 1,
217217
name: 'Some group',
@@ -232,15 +232,15 @@ describe('userGroupsReducer', () => {
232232
},
233233
];
234234

235-
const actualState = userGroupsReducer(initialState, action);
235+
const actualState = userGroupsReducer(prevState, action);
236236

237237
expect(actualState).toEqual(expectedState);
238238
});
239239
});
240240

241241
describe('EVENT_USER_GROUP_REMOVE_MEMBERS', () => {
242242
test('if user group does not exist state does not change', () => {
243-
const initialState = deepFreeze([]);
243+
const prevState = deepFreeze([]);
244244
const action = deepFreeze({
245245
type: EVENT_USER_GROUP_REMOVE_MEMBERS,
246246
op: 'remove_members',
@@ -249,13 +249,13 @@ describe('userGroupsReducer', () => {
249249
});
250250
const expectedState = [];
251251

252-
const actualState = userGroupsReducer(initialState, action);
252+
const actualState = userGroupsReducer(prevState, action);
253253

254254
expect(actualState).toEqual(expectedState);
255255
});
256256

257257
test('removes members from an existing user group', () => {
258-
const initialState = deepFreeze([
258+
const prevState = deepFreeze([
259259
{
260260
id: 1,
261261
name: 'Some group',
@@ -286,7 +286,7 @@ describe('userGroupsReducer', () => {
286286
},
287287
];
288288

289-
const actualState = userGroupsReducer(initialState, action);
289+
const actualState = userGroupsReducer(prevState, action);
290290

291291
expect(actualState).toEqual(expectedState);
292292
});

0 commit comments

Comments
 (0)