From be22ef1774a720e30e52a34831135ebdf699cc2b Mon Sep 17 00:00:00 2001 From: Florent Vilmart Date: Fri, 15 Jul 2016 15:32:31 -0400 Subject: [PATCH] Better password stripping tests --- spec/FileLoggerAdapter.spec.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/spec/FileLoggerAdapter.spec.js b/spec/FileLoggerAdapter.spec.js index b992158c9a..2816e95c34 100644 --- a/spec/FileLoggerAdapter.spec.js +++ b/spec/FileLoggerAdapter.spec.js @@ -59,7 +59,10 @@ describe('verbose logs', () => { level: 'verbose' }); }).then((results) => { - expect(results[1].body.password).toEqual("********"); + let logString = JSON.stringify(results); + expect(logString.match(/\*\*\*\*\*\*\*\*/g).length).not.toBe(0); + expect(logString.match(/moon-y/g)).toBe(null); + var headers = { 'X-Parse-Application-Id': 'test', 'X-Parse-REST-API-Key': 'rest' @@ -74,11 +77,16 @@ describe('verbose logs', () => { size: 100, level: 'verbose' }).then((results) => { - expect(results[1].url.includes('password=********')).toEqual(true); + let logString = JSON.stringify(results); + expect(logString.match(/\*\*\*\*\*\*\*\*/g).length).not.toBe(0); + expect(logString.match(/moon-y/g)).toBe(null); done(); }); }); - }); + }).catch((err) => { + fail(JSON.stringify(err)); + done(); + }) }); it("should not mask information in non _User class", (done) => {