Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // remove sensitive data
- const hashData = (xs, y) => R.mapObjIndexed((x, key) => key.includes(y) ? '******' : x, xs);
- // tests
- describe('hashData', () => {
- it('should hash out sensitive information as expected', async () => {
- // given ... object that includes sensitive information
- const sensitiveObject = {
- username: 'john',
- password: 'my-super-secret-password',
- };
- // when ... we run the hashData function providing which data to hash
- const result = SUT.hashData(sensitiveObject, ['password']);
- // then ... returned data should be as expected
- const expectedResult = {
- username: 'john',
- password: '******',
- };
- assert.deepEqual(result, expectedResult);
- });
- });
Add Comment
Please, Sign In to add comment