X-Git-Url: http://git.squeep.com/?p=squeep-authentication-module;a=blobdiff_plain;f=test%2Flib%2Fcommon.js;fp=test%2Flib%2Fcommon.js;h=82b80f0db7a18f7e1ef35b2b13bccdec18d671a0;hp=921479ce839b49c1b569f958d501e52d701116f0;hb=05f10d7419d363570d3c553afc0aed211afecb4b;hpb=a821a0f79c42f8ea55aec503c992650113d82028 diff --git a/test/lib/common.js b/test/lib/common.js index 921479c..82b80f0 100644 --- a/test/lib/common.js +++ b/test/lib/common.js @@ -49,7 +49,7 @@ describe('Common', function () { afterEach(function () { sinon.restore(); }); - it('covers', function () { + it('covers', function () { const stat = { packageName: 'fake-mystery-box', packageVersion: '0.0.0', @@ -61,4 +61,21 @@ describe('Common', function () { }); }); // mysteryBoxLogger + describe('obscureAuthorizationHeader', function () { + it('blurs Bearer token', function () { + const result = common.obscureAuthorizationHeader('Bearer foo'); + assert.strictEqual(result, 'Bearer ***'); + }); + it('blurs entire string for other', function () { + const result = common.obscureAuthorizationHeader('abcdef'); + assert.strictEqual(result, '******'); + }); + it('covers empty string', function () { + const a = ''; + const result = common.obscureAuthorizationHeader(a); + assert.strictEqual(result, a); + + }); + }); + }); // Common \ No newline at end of file