X-Git-Url: http://git.squeep.com/?p=squeep-indie-auther;a=blobdiff_plain;f=test%2Fsrc%2Fcommon.js;fp=test%2Fsrc%2Fcommon.js;h=a24db1f2b761605c9e0a7adc56008f2f71d319eb;hp=1115f0ab5114c40466147bf821313f796a54e229;hb=07bf59d8ac7f5fc6d5ac5e6b92a37afdbb896790;hpb=7d0017cc3700b2c2b1b89944ab9eb305de362dd1 diff --git a/test/src/common.js b/test/src/common.js index 1115f0a..a24db1f 100644 --- a/test/src/common.js +++ b/test/src/common.js @@ -2,6 +2,8 @@ 'use strict'; const assert = require('assert'); +const sinon = require('sinon'); +const StubLogger = require('../stub-logger'); const common = require('../../src/common'); describe('Common', function () { @@ -178,4 +180,43 @@ describe('Common', function () { }); }); // dateToEpoch + describe('omit', function () { + it('covers', function () { + const obj = { + foo: true, + bar: 'bar', + baz: { + quux: false, + }, + }; + const omitted = ['bar', 'baz']; + const expected = { + foo: true, + }; + const result = common.omit(obj, omitted); + assert.deepStrictEqual(result, expected); + }); + }); // omit + + describe('mysteryBoxLogger', function () { + let mbl, stubLogger; + beforeEach(function () { + stubLogger = new StubLogger(); + stubLogger._reset(); + mbl = common.mysteryBoxLogger(stubLogger, 'test:scope'); + }); + afterEach(function () { + sinon.restore(); + }); + it('covers', function () { + const stat = { + packageName: 'fake-mystery-box', + packageVersion: '0.0.0', + data: 'exists', + }; + mbl(stat); + assert(stubLogger.debug.called); + }); + }); // mysteryBoxLogger + }); // Common