Merge "Add tests to Crypto module"
[aai/sparky-fe.git] / test / utils / Crypto.test.js
1 import {decrypt, encrypt, encode, decode} from 'utils/Crypto.js';
2
3 describe('Crypto', () => {
4     it('encrypt and decrypt text properly', () => {
5         // given
6         const stringToEncrypt = 'textToEncrypt';
7
8         // when
9         const encryptedString = encrypt(stringToEncrypt);
10
11         // then
12         const decryptedString = decrypt(encryptedString);
13         expect(decryptedString).toBe(stringToEncrypt);
14     });
15
16     it('encode and decode text properly', () => {
17         // given
18         const stringToEncrypt = 'textToEncode';
19
20         // when
21         const encryptedString = encode(stringToEncrypt);
22
23         // then
24         const decryptedString = decode(encryptedString);
25         expect(decryptedString).toBe(stringToEncrypt);
26     });
27
28 });