remove unused function
[squeep-indie-auther] / test / src / common.js
index 1115f0ab5114c40466147bf821313f796a54e229..36b841940790c75720e68667e95743fa546de9ee 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 () {
@@ -50,48 +52,6 @@ describe('Common', function () {
     });
   }); // freezeDeep
 
-  describe('axiosResponseLogData', function () {
-    it('covers', function () {
-      const response = {
-        status: 200,
-        statusText: 'OK',
-        headers: {
-          'Content-Type': 'text/plain',
-        },
-        otherData: 'blah',
-        data: 'Old Mother West Wind had stopped to talk with the Slender Fir Tree. "I\'ve just come across the Green Meadows," said Old Mother West Wind, “and there I saw the Best Thing in the World.”',
-      };
-      const expected = {
-        status: 200,
-        statusText: 'OK',
-        headers: {
-          'Content-Type': 'text/plain',
-        },
-        data: 'Old Mother West Wind had stopped to talk with the Slender Fir Tree. "I\'ve just come across the Green... (184 bytes)',
-      };
-      const result = common.axiosResponseLogData(response);
-      assert.deepStrictEqual(result, expected);
-    });
-    it('covers no data', function () {
-      const response = {
-        status: 200,
-        statusText: 'OK',
-        headers: {
-          'Content-Type': 'text/plain',
-        },
-      };
-      const expected = {
-        status: 200,
-        statusText: 'OK',
-        headers: {
-          'Content-Type': 'text/plain',
-        },
-      };
-      const result = common.axiosResponseLogData(response);
-      assert.deepStrictEqual(result, expected);
-    });
-  }); // axiosResponseLogData
-
   describe('logTruncate', function () {
     it('returns short string', function () {
       const str = 'this is a short string';
@@ -178,4 +138,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