Download spectrum/shared/test/encryption.test.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 867 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/test/encryption.test.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/shared/test/encryption.test.js
-
curl -L -o encryption.test.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/shared/test/encryption.test.js
867 Bytes
| // @flow | |
| import { | |
| encryptString, | |
| decryptString, | |
| encryptObject, | |
| decryptObject, | |
| } from '../encryption'; | |
| const inputString = 'this should be encrypted'; | |
| const inputObject = { foo: 'bar', biz: 'baz' }; | |
| it('should encrypt and decrypt a string', () => { | |
| const encrypted = encryptString(inputString); | |
| const decrypted = decryptString(encrypted); | |
| expect(encrypted).not.toEqual(inputString); | |
| expect(decrypted).toEqual(inputString); | |
| expect(typeof decrypted).toEqual('string'); | |
| expect(typeof encrypted).toEqual('string'); | |
| }); | |
| it('should encrypt and decrypt a object', () => { | |
| const encrypted = encryptObject(inputObject); | |
| const decrypted = decryptObject(encrypted); | |
| expect(encrypted).not.toEqual(inputObject); | |
| expect(decrypted).toEqual(inputObject); | |
| expect(typeof decrypted).toEqual('object'); | |
| expect(typeof encrypted).toEqual('string'); | |
| }); | |