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
/
admin_console_index.test.jsx
71 lines (64 loc) · 2.54 KB
/
admin_console_index.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
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {IntlProvider} from 'react-intl';
import {generateIndex} from './admin_console_index.jsx';
const enMessages = require('../i18n/en');
const esMessages = require('../i18n/es');
describe('AdminConsoleIndex.generateIndex', () => {
it('should generate a index where I can search', () => {
const intlProvider = new IntlProvider({locale: 'en', messages: enMessages, defaultLocale: 'en'}, {});
const {intl} = intlProvider.getChildContext();
const idx = generateIndex(intl);
expect(idx.search('ldap')).toEqual([
'environment/session_lengths',
'authentication/mfa',
'authentication/ldap',
'authentication/saml',
'experimental/features',
'authentication/email',
]);
expect(idx.search('saml')).toEqual([
'authentication/saml',
'environment/session_lengths',
'authentication/email',
'experimental/features',
]);
expect(idx.search('nginx')).toEqual([
'environment/rate_limiting',
]);
expect(idx.search('characters')).toEqual([
'authentication/password',
'site_config/customization',
]);
expect(idx.search('caracteres')).toEqual([]);
expect(idx.search('notexistingword')).toEqual([]);
});
it('should generate a index where I can search in other language', () => {
const intlProvider = new IntlProvider({locale: 'es', messages: esMessages, defaultLocale: 'es'}, {});
const {intl} = intlProvider.getChildContext();
const idx = generateIndex(intl);
expect(idx.search('ldap')).toEqual([
'environment/session_lengths',
'authentication/mfa',
'authentication/ldap',
'authentication/saml',
'experimental/features',
'authentication/email',
]);
expect(idx.search('saml')).toEqual([
'authentication/saml',
'environment/session_lengths',
'authentication/email',
'experimental/features',
]);
expect(idx.search('nginx')).toEqual([
'environment/rate_limiting',
]);
expect(idx.search('caracteres')).toEqual([
'site_config/customization',
'authentication/password',
]);
expect(idx.search('characters')).toEqual([]);
expect(idx.search('notexistingword')).toEqual([]);
});
});