From 4961228c0047a041048751aa4efc132a2828b588 Mon Sep 17 00:00:00 2001 From: m5r Date: Wed, 17 Jul 2024 16:21:10 +0200 Subject: [PATCH] okay that fixed it, revert test back and remove logs --- src/lib/warn-upload-overwrite.js | 12 ------------ test/lib/warn-upload-overwrite.spec.js | 4 ++-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/lib/warn-upload-overwrite.js b/src/lib/warn-upload-overwrite.js index ceaf371c..c64087ef 100644 --- a/src/lib/warn-upload-overwrite.js +++ b/src/lib/warn-upload-overwrite.js @@ -153,18 +153,6 @@ const preUploadDoc = async (db, localDoc) => { const diff = jsonDiff.diffString(remoteDoc, localDoc, { color: true }); - // eslint-disable-next-line - const colors = require('json-diff/node_modules/colors/safe'); - // eslint-disable-next-line - console.log("supports color", colors.supportsColor(), colors.enabled); - // eslint-disable-next-line - console.log(colors.green); - // eslint-disable-next-line - console.log(colors.red); - // eslint-disable-next-line - console.log("diff", JSON.stringify(diff)); - // eslint-disable-next-line - console.log("diff2", diff); if (diff) { let index = userPrompt.keyInSelect(responseChoicesWithDiff, question, {cancel: false}); if (index === 2) { // diff diff --git a/test/lib/warn-upload-overwrite.spec.js b/test/lib/warn-upload-overwrite.spec.js index 76eb31b9..cc114745 100644 --- a/test/lib/warn-upload-overwrite.spec.js +++ b/test/lib/warn-upload-overwrite.spec.js @@ -121,7 +121,7 @@ describe('warn-upload-overwrite', () => { describe('prompts when attempting to overwrite docs', () => { - it('shows diff when local is different from remote and the user requests a diff', () => { + it.only('shows diff when local is different from remote and the user requests a diff', () => { sinon.stub(readline, 'keyInYN').returns(true); sinon.stub(readline, 'keyInSelect').returns(2); sinon.stub(apiStub.db, 'get').resolves({ _id: 'a', _rev: 'x', value: 1 }); @@ -134,7 +134,7 @@ describe('warn-upload-overwrite', () => { assert.equal(calls.length, 1); assert.equal(request.get.args[0][0].url, 'http://admin:pass@localhost:35423/api/couch-config-attachments'); assert.equal(request.get.callCount, 1); - assert.equal(calls[0][0], ' {\n- _rev: "x"\n- value: 1\n+ value: 2\n }\n'); + assert.equal(calls[0][0], ' {\n\u001b[31m- _rev: "x"\u001b[39m\n\u001b[31m- value: 1\u001b[39m\n\u001b[32m+ value: 2\u001b[39m\n }\n'); }); });