From aebfb9303bc284952eb6decd2981fb0761fdacc5 Mon Sep 17 00:00:00 2001 From: kennsippell Date: Thu, 12 Dec 2024 15:19:33 -0800 Subject: [PATCH] --disable-users also needed on upload-docs --- src/fn/upload-docs.js | 6 ++++-- test/fn/upload-docs.spec.js | 4 ---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/fn/upload-docs.js b/src/fn/upload-docs.js index 968dcfea..31ac859c 100644 --- a/src/fn/upload-docs.js +++ b/src/fn/upload-docs.js @@ -39,8 +39,10 @@ async function execute() { userPrompt.warnPromptAbort(`This operation will permanently write ${totalCount} docs. Are you sure you want to continue?`); - const deletedDocIds = analysis.map(result => result.delete).filter(Boolean); - await handleUsersAtDeletedFacilities(deletedDocIds); + if (args['disable-users']) { + const deletedDocIds = analysis.map(result => result.delete).filter(Boolean); + await handleUsersAtDeletedFacilities(deletedDocIds); + } const results = { ok:[], failed:{} }; const progress = log.level > log.LEVEL_ERROR ? progressBar.init(totalCount, '{{n}}/{{N}} docs ', ' {{%}} {{m}}:{{s}}') : null; diff --git a/test/fn/upload-docs.spec.js b/test/fn/upload-docs.spec.js index 10006238..bf2331bf 100644 --- a/test/fn/upload-docs.spec.js +++ b/test/fn/upload-docs.spec.js @@ -48,8 +48,6 @@ describe('upload-docs', function() { }); it('should upload docs to pouch', async () => { - apiStub.giveResponses(API_VERSION_RESPONSE); - await assertDbEmpty(); await uploadDocs.execute(); const res = await apiStub.db.allDocs(); @@ -91,7 +89,6 @@ describe('upload-docs', function() { expectedDocs = new Array(10).fill('').map((x, i) => ({ _id: i.toString() })); const clock = sinon.useFakeTimers(0); const imported_date = new Date().toISOString(); - apiStub.giveResponses(API_VERSION_RESPONSE); return uploadDocs.__with__({ INITIAL_BATCH_SIZE: 4, Date, @@ -132,7 +129,6 @@ describe('upload-docs', function() { }); it('should not throw if force is set', async () => { - apiStub.giveResponses(API_VERSION_RESPONSE); userPrompt.__set__('environment', { force: () => true }); await assertDbEmpty(); sinon.stub(process, 'exit');