update dependencies and devDependencies, fix breaking changes from myster-box
[squeep-indie-auther] / test / src / common.js
index 1115f0ab5114c40466147bf821313f796a54e229..a24db1f2b761605c9e0a7adc56008f2f71d319eb 100644 (file)
@@ -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