X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=test%2Futils%2FCrypto.test.js;fp=test%2Futils%2FCrypto.test.js;h=e1f75669573e992be2e5901834f47352b2b4b3de;hb=0585d992983e2d3b605d7dabc4178db5ffc1fa49;hp=0000000000000000000000000000000000000000;hpb=17ccebdd4b886ce3e2db145633cf6aa61f544695;p=aai%2Fsparky-fe.git 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); + }); + +});