summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Forsyth <jf2512@att.com>2018-09-19 15:59:53 +0000
committerGerrit Code Review <gerrit@onap.org>2018-09-19 15:59:53 +0000
commit21ab8d88d55d264eff83d628ba924e95cff52fc4 (patch)
tree63dbd2c44e573ea4383090da95f560bc4035e3d8
parenta76f517ed1989952fa896ec1fb919fcc12dd0cd7 (diff)
parent0585d992983e2d3b605d7dabc4178db5ffc1fa49 (diff)
Merge "Add tests to Crypto module"
-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);
+ });
+
+});