summaryrefslogtreecommitdiffstats
path: root/webapp/tests/utils/latinise.test.jsx
blob: c508595246fc044d914c11ece18bf5ab49be94b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.

import {latinise} from 'utils/latinise.jsx';

describe('Latinise', () => {
    describe('handleNames', () => {
        test('should return ascii version of Dév Spé', () => {
            expect(latinise('Dév Spé')).
                toEqual('Dev Spe');
        });

        test('should not replace any characters', () => {
            expect(latinise('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890')).
                toEqual('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890');
        });

        test('should replace characters with diacritics with ascii equivalents', () => {
            expect(latinise('àáâãäåæçèéêëìíîïñòóôõöœùúûüýÿ')).
                toEqual('aaaaaaaeceeeeiiiinooooooeuuuuyy');
        });
    });
});