From d41e3cd6fc9a553fc757bd1cfaa0fa47e373d3d9 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Fri, 6 Apr 2018 13:24:43 -0400 Subject: [PATCH] Add test for regular `_redactPath` --- test/modules/privacy_test.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/modules/privacy_test.js b/test/modules/privacy_test.js index 797c900eda..46bb8c5f10 100644 --- a/test/modules/privacy_test.js +++ b/test/modules/privacy_test.js @@ -56,6 +56,19 @@ describe('Privacy', () => { }); describe('_redactPath', () => { + it('should redact file paths', () => { + const testPath = '/Users/meow/Library/Application Support/Signal Beta'; + const text = 'This is a log line with sensitive information:\n' + + `path1 ${testPath}/main.js\n` + + 'phone1 +12223334455 ipsum\n'; + + const actual = Privacy._redactPath(testPath)(text); + const expected = 'This is a log line with sensitive information:\n' + + 'path1 [REDACTED]/main.js\n' + + 'phone1 +12223334455 ipsum\n'; + assert.equal(actual, expected); + }); + it('should redact URL-encoded paths', () => { const testPath = '/Users/meow/Library/Application Support/Signal Beta'; const encodedTestPath = encodeURI(testPath);