summaryrefslogtreecommitdiffstats
path: root/test/utils/Crypto.test.js
blob: e1f75669573e992be2e5901834f47352b2b4b3de (plain)
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
import {decrypt, encrypt, encode, decode} from 'utils/Crypto.js';

describe('Crypto', () => {
    it('encrypt and decrypt text properly', () => {
        // given
        const stringToEncrypt = 'textToEncrypt';

        // when
        const encryptedString = encrypt(stringToEncrypt);

        // then
        const decryptedString = decrypt(encryptedString);
        expect(decryptedString).toBe(stringToEncrypt);
    });

    it('encode and decode text properly', () => {
        // given
        const stringToEncrypt = 'textToEncode';

        // when
        const encryptedString = encode(stringToEncrypt);

        // then
        const decryptedString = decode(encryptedString);
        expect(decryptedString).toBe(stringToEncrypt);
    });

});