From 8599aa8d2706b9fcf4cdecb663e5c9204989bae1 Mon Sep 17 00:00:00 2001 From: Justin Wind Date: Sat, 10 Jun 2023 14:31:27 -0700 Subject: [PATCH] remove unused function --- src/common.js | 20 -------------------- test/src/common.js | 42 ------------------------------------------ 2 files changed, 62 deletions(-) diff --git a/src/common.js b/src/common.js index 90ae9d2..1972e08 100644 --- a/src/common.js +++ b/src/common.js @@ -6,25 +6,6 @@ const { randomBytes } = require('crypto'); const { promisify } = require('util'); const randomBytesAsync = promisify(randomBytes); -/** - * Pick out useful axios response fields. - * @param {*} res - * @returns - */ -const axiosResponseLogData = (res) => { - const data = common.pick(res, [ - 'status', - 'statusText', - 'headers', - 'elapsedTimeMs', - 'data', - ]); - if (data.data) { - data.data = logTruncate(data.data, 100); - } - return data; -}; - /** * Limit length of string to keep logs sane * @param {String} str @@ -175,7 +156,6 @@ const mysteryBoxLogger = (logger, scope) => { module.exports = { ...common, - axiosResponseLogData, camelfy, dateToEpoch, ensureArray, diff --git a/test/src/common.js b/test/src/common.js index a24db1f..36b8419 100644 --- a/test/src/common.js +++ b/test/src/common.js @@ -52,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'; -- 2.45.2