Skip to content

Commit

Permalink
okay that fixed it, revert test back and remove logs
Browse files Browse the repository at this point in the history
  • Loading branch information
m5r committed Jul 17, 2024
1 parent ca8dc92 commit 4961228
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
12 changes: 0 additions & 12 deletions src/lib/warn-upload-overwrite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/lib/warn-upload-overwrite.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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');
});
});

Expand Down

0 comments on commit 4961228

Please sign in to comment.