Skip to content

Commit 9edd77b

Browse files
committed
accountsReducer tests: Test that REALM_INIT records feature level.
Like we did for `zulipVersion`, except the interesting data is found on `action.data`, not `action`, as I mention in zulip#4079 (comment).
1 parent 6c08765 commit 9edd77b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/account/__tests__/accountsReducer-test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,29 @@ describe('accountsReducer', () => {
162162
expect(newState).toEqual(expectedState);
163163
expect(newState).not.toBe(prevState);
164164
});
165+
166+
test('records zulipFeatureLevel on active account', () => {
167+
const prevState = deepFreeze([account1, account2, account3]);
168+
const newZulipFeatureLevel = 6;
169+
const action = deepFreeze({
170+
...eg.action.realm_init,
171+
data: {
172+
...eg.action.realm_init.data,
173+
zulip_feature_level: newZulipFeatureLevel,
174+
},
175+
});
176+
177+
const expectedState = [
178+
{ ...account1, zulipFeatureLevel: newZulipFeatureLevel },
179+
account2,
180+
account3,
181+
];
182+
183+
const newState = accountsReducer(prevState, action);
184+
185+
expect(newState).toEqual(expectedState);
186+
expect(newState).not.toBe(prevState);
187+
});
165188
});
166189

167190
describe('ACCOUNT_SWITCH', () => {

0 commit comments

Comments
 (0)