This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
system_users_list.test.jsx
73 lines (65 loc) · 2.16 KB
/
system_users_list.test.jsx
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React from 'react';
import {shallow} from 'enzyme';
import {Constants} from 'utils/constants.jsx';
import SystemUsersList from 'components/admin_console/system_users/list/system_users_list.jsx';
describe('components/admin_console/system_users/list', () => {
const defaultProps = {
users: [],
usersPerPage: 0,
total: 0,
nextPage: jest.fn(),
search: jest.fn(),
focusOnMount: false,
renderFilterRow: jest.fn(),
teamId: '',
term: '',
onTermChange: jest.fn(),
mfaEnabled: false,
enableUserAccessTokens: false,
experimentalEnableAuthenticationTransfer: false,
actions: {
getUser: jest.fn(),
updateTeamMemberSchemeRoles: jest.fn(),
getTeamMembersForUser: jest.fn(),
getTeamsForUser: jest.fn(),
removeUserFromTeam: jest.fn(),
},
};
test('should match default snapshot', () => {
const props = defaultProps;
const wrapper = shallow(<SystemUsersList {...props}/>);
expect(wrapper).toMatchSnapshot();
});
describe('should match default snapshot, with users', () => {
const props = {
...defaultProps,
users: [
{id: 'id1'},
{id: 'id2'},
{id: 'id3', auth_service: Constants.LDAP_SERVICE},
{id: 'id4', auth_service: Constants.SAML_SERVICE},
{id: 'id5', auth_service: 'other service'},
],
};
it('and mfa enabled', () => {
const wrapper = shallow(
<SystemUsersList
{...props}
mfaEnabled={true}
/>
);
expect(wrapper).toMatchSnapshot();
});
it('and mfa disabled', () => {
const wrapper = shallow(
<SystemUsersList
{...props}
mfaEnabled={false}
/>
);
expect(wrapper).toMatchSnapshot();
});
});
});