summaryrefslogtreecommitdiffstats
path: root/test/utils
diff options
context:
space:
mode:
authorbogumil_zebek <bogumil.zebek@nokia.com>2018-09-18 12:52:03 +0200
committerbogumil_zebek <bogumil.zebek@nokia.com>2018-09-18 13:02:15 +0200
commit0585d992983e2d3b605d7dabc4178db5ffc1fa49 (patch)
tree19aee2e721ea7ecda517fbf91dcb00f5e371b2f7 /test/utils
parent17ccebdd4b886ce3e2db145633cf6aa61f544695 (diff)
Add tests to Crypto module
Issue-ID: AAI-1618 Change-Id: Iaaadcacaca2f2c1e7af0a952cad1dca3fc027258 Signed-off-by: Bogumil Zebek <bogumil.zebek@nokia.com>
Diffstat (limited to 'test/utils')
-rw-r--r--test/utils/Crypto.test.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/utils/Crypto.test.js b/test/utils/Crypto.test.js
new file mode 100644
index 0000000..e1f7566
--- /dev/null
+++ b/test/utils/Crypto.test.js
@@ -0,0 +1,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);
+ });
+
+});