From: James Forsyth Date: Wed, 19 Sep 2018 15:59:53 +0000 (+0000) Subject: Merge "Add tests to Crypto module" X-Git-Tag: 1.3.0~6 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=aai%2Fsparky-fe.git;a=commitdiff_plain;h=21ab8d88d55d264eff83d628ba924e95cff52fc4;hp=a76f517ed1989952fa896ec1fb919fcc12dd0cd7 Merge "Add tests to Crypto module" --- 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); + }); + +});