From 6b6c4f585b4eed79c8f93aa2fbfa967a3ecef9ee Mon Sep 17 00:00:00 2001 From: Foromo Ernest Teoro Date: Tue, 5 Nov 2024 14:39:20 +0100 Subject: [PATCH] Revert "Add unit test for stock out" This reverts commit c9a7dc657c76a6c05bbb2927f182c229686382b1. --- src/add-feature.js | 10 +-------- src/features/stock-out.js | 34 ++---------------------------- test/mocks/mocks.js | 44 --------------------------------------- 3 files changed, 3 insertions(+), 85 deletions(-) diff --git a/src/add-feature.js b/src/add-feature.js index cbbfeae..8819ffc 100644 --- a/src/add-feature.js +++ b/src/add-feature.js @@ -44,15 +44,7 @@ async function selectFeature(configs) { choices: remainingFeatures.map((ft) => ({ name: FEATURES[ft], value: ft, - })), - when: function (answers){ - const argv = process.argv; - if (!argv[4]){ - return true; - } - answers.name = argv[4]; - return false; - } + })) } ]); diff --git a/src/features/stock-out.js b/src/features/stock-out.js index 477d9d1..88ec7a4 100644 --- a/src/features/stock-out.js +++ b/src/features/stock-out.js @@ -263,15 +263,7 @@ async function getStockOutConfigs({ type: 'input', name: 'form_name', message: 'Enter stock out form ID', - default: 'stock_out', - when: function (answers){ - const argv = process.argv; - if (!argv[5]){ - return true; - } - answers.form_name = argv[5]; - return false; - } + default: 'stock_out' }, { type: 'list', @@ -287,34 +279,12 @@ async function getStockOutConfigs({ value: 'weekly_qty' } ], - when: function (answers){ - const argv = process.argv; - if (!argv[6]){ - return true; - } - answers.formular = argv[6]; - return false; - } }, ...languages.map((language) => ({ type: 'input', name: `title.${language}`, message: `Enter stock out form title in ${language}`, - default: 'Stock Out', - when: function (answers){ - const argv = process.argv; - if (!argv[7]){ - return true; - } - const answer = { - title:{ - 'en': argv[7].split(',')[0], - 'fr': argv[7].split(',')[1] - } - }; - Object.assign(answers, answer); - return false; - } + default: 'Stock Out' })) ]); return configs; diff --git a/test/mocks/mocks.js b/test/mocks/mocks.js index 2cb7183..669bec3 100644 --- a/test/mocks/mocks.js +++ b/test/mocks/mocks.js @@ -129,50 +129,6 @@ module.exports = { 'paracetamol___count' ] - }, - - stockOutScenario: { - initScenario: [ - 'init', - '2_levels', - 'c62_chw', - 'chw', - 'c52_supervisor', - 'supervisor', - 'Y', - 'stock_count', - '[{contact_type: \'c62_chw\', role: \'chw\', place_type: \'c60_chw_site\' },{contact_type: \'c52_supervisor\',role: \'supervisor\',place_type: \'c50_supervision_area\'}]', - 'action', - 'end_of_week', - ['Stock count', 'Stock count'], - 'patient_assessment_under_5', - 'Y', - 'now()', - 'malaria', - ['Category', 'Categorie'], - ['Category', 'Categorie'], - 'paracetamol', - ['Paracetamol', 'Paracetamole'], - 'Y', - ['Box of 8', 'Boite de 8'], - 8, - ['Tablet', 'Comprimes'], - 20, - 15, - 15, - 'by_user', - 0, - ], - addStockOutFeatureScenario: [ - 'add', 'feature', 'stock_out', 'stock_out', 'item_danger_qty', ['Stock Out', 'Stock Out'] - ], - productsScenario: [ - 'paracetamol_at_hand___set', - 'paracetamol_at_hand___unit', - 'paracetamol_required___set', - 'paracetamol_required___unit' - ] - } };