forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
channel_sidebar.test.ts
33 lines (24 loc) · 1.14 KB
/
channel_sidebar.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import configureStore from 'store';
import {isCategoryCollapsedFromStorage} from 'selectors/views/channel_sidebar';
import {getPrefix} from 'utils/storage_utils';
import * as Actions from './channel_sidebar';
describe('setCategoryCollapsed', () => {
test('should save category expanded and category collapsed', async () => {
const category1 = 'category1';
const initialState = {
users: {
currentUserId: 'user1',
profiles: {
user1: {},
}
}
};
const store = await configureStore(initialState);
store.dispatch(Actions.setCategoryCollapsed(category1, true));
expect(isCategoryCollapsedFromStorage(getPrefix(store.getState()), store.getState().storage.storage, category1)).toBe(true);
store.dispatch(Actions.setCategoryCollapsed(category1, false));
expect(isCategoryCollapsedFromStorage(getPrefix(store.getState()), store.getState().storage.storage, category1)).toBe(false);
});
});