Skip to content

Commit

Permalink
fix(test and server): Fix the end to end test and the server side log…
Browse files Browse the repository at this point in the history
…ic to filter stock movement by
  • Loading branch information
DedrickEnc committed Aug 17, 2017
1 parent c2e794a commit 999b9a8
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion client/src/modules/stock/entry/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ function StockEntryController(Depots, Inventory, Notify,
.then(function (document) {
vm.Stock.store.clear();
vm.movement = {};
ReceiptModal.stockEntryDepotReceipt(document.uuid, bhConstants.flux.FROM_OTHER_DEPOT);
ReceiptModal.stockEntryDepotReceipt(document.uuid, true);
})
.catch(Notify.handleError);
}
Expand Down
3 changes: 2 additions & 1 deletion server/controllers/stock/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ function getLots(sqlQuery, parameters, finalClauseParameter) {
JOIN stock_movement m ON m.lot_uuid = l.uuid AND m.flux_id = ${flux.FROM_PURCHASE}
JOIN depot d ON d.uuid = m.depot_uuid
`;
db.convert(params, ['uuid', 'depot_uuid', 'lot_uuid', 'inventory_uuid']);
db.convert(params, ['uuid', 'depot_uuid', 'lot_uuid', 'inventory_uuid', 'document_uuid']);
const filters = new FilterParser(params, { autoParseStatements : false });

filters.equals('uuid', 'uuid', 'l');
filters.equals('depot_text', 'text', 'd');
filters.equals('depot_uuid', 'depot_uuid', 'm');
filters.equals('document_uuid', 'document_uuid', 'm');
filters.equals('lot_uuid', 'lot_uuid', 'm');
filters.equals('inventory_uuid', 'uuid', 'i');
filters.equals('text', 'text', 'i');
Expand Down
2 changes: 1 addition & 1 deletion test/end-to-end/stock/stock.adjustment.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ function StockAdjustmentTests() {
});
}

describe('Stock Adustment Test', StockAdjustmentTests);
describe('Stock Adjustment Test', StockAdjustmentTests);
2 changes: 1 addition & 1 deletion test/end-to-end/stock/stock.entry.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function StockExiTests() {

it('Should entry stock from a transfer reception', () => {
// select the movement
page.setTransfer(0);
page.setTransfer(1);

page.setDate(new Date());

Expand Down
4 changes: 2 additions & 2 deletions test/end-to-end/stock/stock.inventories.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function StockInventoriesRegistryTests() {
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.depot_uuid', 'Depot Secondaire');
FU.modal.submit();
GU.expectRowCount(gridId, 1 + depotGroupingRow);
GU.expectRowCount(gridId, 2 + depotGroupingRow);

FU.buttons.search();
FU.uiSelect('$ctrl.bundle.depot_uuid', 'Depot Principal');
Expand Down Expand Up @@ -71,7 +71,7 @@ function StockInventoriesRegistryTests() {
FU.buttons.search();
FU.radio('$ctrl.bundle.status', 4);
FU.modal.submit();
GU.expectRowCount(gridId, 2 + (2 * depotGroupingRow));
GU.expectRowCount(gridId, 3 + (2 * depotGroupingRow));

// clear filters
FU.buttons.clear();
Expand Down
8 changes: 4 additions & 4 deletions test/end-to-end/stock/stock.lots.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ function StockLotsRegistryTests() {
const gridId = 'stock-lots-grid';

const depotGroupingRow = 1;
const LOT_FOR_ALLTIME = 15;
const LOT_FOR_ALLTIME = 16;
const LOT_FOR_TODAY = 10;
const LOT_FOR_LAST_YEAR = 15;
const LOT_FOR_LAST_YEAR = 16;


it(`finds ${LOT_FOR_TODAY} lot for today`, () => {
Expand Down Expand Up @@ -67,13 +67,13 @@ function StockLotsRegistryTests() {
it('find lot by name', () => {
modal.setLotLabel('VITAMINE-A');
modal.submit();
GU.expectRowCount(gridId, 1 + depotGroupingRow);
GU.expectRowCount(gridId, 3 + depotGroupingRow);
});

it('find lots by entry date', () => {
modal.setdateInterval('02/02/2017', '02/02/2017', 'entry-date');
modal.submit();
GU.expectRowCount(gridId, 4 + (2 * depotGroupingRow));
GU.expectRowCount(gridId, 6 + (2 * depotGroupingRow));
});

it('find lots by expiration date', () => {
Expand Down
20 changes: 10 additions & 10 deletions test/end-to-end/stock/stock.movements.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function StockMovementsRegistryTests() {
FU.buttons.search();
FU.radio('$ctrl.bundle.is_exit', 0);
FU.modal.submit();
GU.expectRowCount(gridId, 14 + (2 * depotGroupingRow));
GU.expectRowCount(gridId, 15 + (2 * depotGroupingRow));

// exit movements
FU.buttons.search();
Expand All @@ -38,7 +38,7 @@ function StockMovementsRegistryTests() {
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.depot_uuid', 'Depot Secondaire');
FU.modal.submit();
GU.expectRowCount(gridId, 5 + depotGroupingRow);
GU.expectRowCount(gridId, 6 + depotGroupingRow);

FU.buttons.search();
FU.uiSelect('$ctrl.bundle.depot_uuid', 'Depot Principal');
Expand Down Expand Up @@ -66,7 +66,7 @@ function StockMovementsRegistryTests() {
FU.buttons.search();
FU.input('$ctrl.bundle.label', 'VITAMINE-A');
FU.modal.submit();
GU.expectRowCount(gridId, 3 + depotGroupingRow);
GU.expectRowCount(gridId, 5 + depotGroupingRow);

// clear filters
FU.buttons.clear();
Expand All @@ -80,37 +80,37 @@ function StockMovementsRegistryTests() {
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.flux_id', 'Commande d\'achat');
FU.modal.submit();
GU.expectRowCount(gridId, 22 + depotGroupingRow);
GU.expectRowCount(gridId, 24 + depotGroupingRow);

// to patient
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.flux_id', 'Vers un patient');
FU.modal.submit();
GU.expectRowCount(gridId, 22 + depotGroupingRow);
GU.expectRowCount(gridId, 24 + depotGroupingRow);

// to depot
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.flux_id', 'Vers un depot');
FU.modal.submit();
GU.expectRowCount(gridId, 22 + depotGroupingRow);
GU.expectRowCount(gridId, 24 + depotGroupingRow);

// from depot
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.flux_id', 'En provenance d\'un depot');
FU.modal.submit();
GU.expectRowCount(gridId, 22 + depotGroupingRow);
GU.expectRowCount(gridId, 24 + depotGroupingRow);

// positive adjustment
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.flux_id', 'Ajustement (Positif)');
FU.modal.submit();
GU.expectRowCount(gridId, 22 + depotGroupingRow);
GU.expectRowCount(gridId, 24 + depotGroupingRow);

// negative adjustment
FU.buttons.search();
FU.uiSelect('$ctrl.bundle.flux_id', 'Ajustement (Negatif)');
FU.modal.submit();
GU.expectRowCount(gridId, 22 + depotGroupingRow);
GU.expectRowCount(gridId, 24 + depotGroupingRow);

// clear filters
FU.buttons.clear();
Expand All @@ -121,7 +121,7 @@ function StockMovementsRegistryTests() {
FU.buttons.search();
components.dateInterval.range('02/02/2017', '02/02/2017');
FU.modal.submit();
GU.expectRowCount(gridId, 6 + depotGroupingRow);
GU.expectRowCount(gridId, 8 + depotGroupingRow);

FU.buttons.search();
components.dateInterval.range('01/01/2015', '30/01/2015');
Expand Down

0 comments on commit 999b9a8

Please sign in to comment.