log-sanitizer
Advanced tools
Comparing version 1.0.1 to 1.0.2
const sanitizer = require('./sanitizer'); | ||
module.exports = sanitizer; | ||
module.exports = sanitizer; |
{ | ||
"name": "log-sanitizer", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "sanitizes personal information in logs", | ||
@@ -8,3 +8,4 @@ "main": "index.js", | ||
"test": "jest", | ||
"coverage": "jest --coverage" | ||
"coverage": "jest --coverage", | ||
"lint": "eslint --ignore-path .gitignore ./" | ||
}, | ||
@@ -14,2 +15,5 @@ "author": "Daren Liu <daren.liu@ww.com>", | ||
"devDependencies": { | ||
"eslint": "^6.6.0", | ||
"eslint-config-airbnb-base": "^14.0.0", | ||
"eslint-plugin-import": "^2.18.2", | ||
"jest": "^24.9.0" | ||
@@ -16,0 +20,0 @@ }, |
@@ -33,3 +33,3 @@ const clonedeep = require('lodash.clonedeep'); | ||
} catch (e) { | ||
// | ||
// return { e }; | ||
} | ||
@@ -39,2 +39,2 @@ } | ||
module.exports = Sanitizer; | ||
module.exports = Sanitizer; |
const Sanitize = require('.'); | ||
const logSanitizer = new Sanitize(['password', 'email']); | ||
describe('Log Sanitizer Tests', () => { | ||
test('Check to see that it creates new object and sanitizes it', () => { | ||
const log = JSON.parse('{"password": "asdf1234"}'); | ||
const log = { "password": "asdf1234" }; | ||
expect(logSanitizer.sanitize(log).password).toBe('*'); | ||
@@ -12,3 +11,3 @@ expect(log.password).toBe("asdf1234"); | ||
test('If object is empty, should return untouched object', () => { | ||
const log = JSON.parse('{}'); | ||
const log = {}; | ||
expect(logSanitizer.sanitize(log)).toBe(log); | ||
@@ -19,3 +18,3 @@ }); | ||
const emptySanitizer = new Sanitize([]); | ||
const log = JSON.parse('{"password": "asdf1234"}'); | ||
const log = { "password": "asdf1234" }; | ||
expect(emptySanitizer.sanitize(log)).toBe(log); | ||
@@ -25,3 +24,3 @@ }); | ||
test('For nested object, check that it sanitizes all levels', () => { | ||
const log = JSON.parse('{"password": "asdf1234", "test": {"password": "asdf1234"}}'); | ||
const log = { "password": "asdf1234", "test": { "password": "asdf1234" } }; | ||
expect(logSanitizer.sanitize(log).password).toBe('*'); | ||
@@ -32,9 +31,5 @@ expect(logSanitizer.sanitize(log).test.password).toBe('*'); | ||
test('For urls, sanitize email if it is one of sanitize fields', () => { | ||
const log = JSON.parse('{"url": "email=test@email.com"}'); | ||
const log = { "url": "email=test@email.com" }; | ||
expect(logSanitizer.sanitize(log).url).toBe('email=*'); | ||
}); | ||
test('If scanning fails, should catch error and return err obj', () => { | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4099
6
89
4