forked from mattermost/mattermost-webapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filter_users.test.js
48 lines (41 loc) · 1.93 KB
/
filter_users.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
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {getUserOptionsFromFilter, searchUserOptionsFromFilter} from './filter_users';
describe('filter_users', () => {
describe('getUserOptionsFromFilter', () => {
it('should return empty options in case of empty filter', () => {
const filters = getUserOptionsFromFilter('');
expect(filters).toEqual({});
});
it('should return empty options in case of undefined', () => {
const filters = getUserOptionsFromFilter(undefined);
expect(filters).toEqual({});
});
it('should return role options in case of system_admin', () => {
const filters = getUserOptionsFromFilter('system_admin');
expect(filters).toEqual({role: 'system_admin'});
});
it('should return inactive option in case of inactive', () => {
const filters = getUserOptionsFromFilter('inactive');
expect(filters).toEqual({inactive: true});
});
});
describe('searchUserOptionsFromFilter', () => {
it('should return empty options in case of empty filter', () => {
const filters = searchUserOptionsFromFilter('');
expect(filters).toEqual({});
});
it('should return empty options in case of undefined', () => {
const filters = searchUserOptionsFromFilter(undefined);
expect(filters).toEqual({});
});
it('should return role options in case of system_admin', () => {
const filters = searchUserOptionsFromFilter('system_admin');
expect(filters).toEqual({role: 'system_admin'});
});
it('should return allow_inactive option in case of inactive', () => {
const filters = searchUserOptionsFromFilter('inactive');
expect(filters).toEqual({allow_inactive: true});
});
});
});