Skip to content

Commit

Permalink
--disable-users also needed on upload-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kennsippell committed Dec 12, 2024
1 parent da6a8cb commit aebfb93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/fn/upload-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions test/fn/upload-docs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit aebfb93

Please sign in to comment.