forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rhs.test.js
54 lines (44 loc) · 1.73 KB
/
rhs.test.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import assert from 'assert';
import * as Selectors from 'selectors/rhs';
describe('Selectors.Rhs', () => {
describe('should return the last time a post was selected', () => {
[0, 1000000, 2000000].forEach((expected) => {
it(`when open is ${expected}`, () => {
const state = {views: {rhs: {
selectedPostFocussedAt: expected,
}}};
assert.deepEqual(expected, Selectors.getSelectedPostFocussedAt(state));
});
});
});
describe('should return the open state of the sidebar', () => {
[true, false].forEach((expected) => {
it(`when open is ${expected}`, () => {
const state = {views: {rhs: {
isSidebarOpen: expected,
}}};
assert.deepEqual(expected, Selectors.getIsRhsOpen(state));
});
});
});
describe('should return the open state of the sidebar menu', () => {
[true, false].forEach((expected) => {
it(`when open is ${expected}`, () => {
const state = {views: {rhs: {
isMenuOpen: expected,
}}};
assert.deepEqual(expected, Selectors.getIsRhsMenuOpen(state));
});
});
});
describe('should return the highlighted reply\'s id', () => {
test.each(['42', ''])('when id is %s', (expected) => {
const state = {views: {rhs: {
highlightedPostId: expected,
}}};
assert.deepEqual(expected, Selectors.getHighlightedPostId(state));
});
});
});