From 426618d58ac5a53b2f2bfb5db37ec6e57904b4e7 Mon Sep 17 00:00:00 2001 From: Jonathan Niles Date: Mon, 28 Feb 2022 18:47:06 +0100 Subject: [PATCH] test(stock): fix stock tests Fixes the stock tests for getting the stock in a depot. --- test/integration-stock/depots.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/integration-stock/depots.js b/test/integration-stock/depots.js index 24640032f3..e990a76f7b 100644 --- a/test/integration-stock/depots.js +++ b/test/integration-stock/depots.js @@ -181,17 +181,6 @@ describe('(/depots) The depots API ', () => { // mock today's date const [today] = new Date().toISOString().split('T'); - it('GET /depots/:uuid/stock returns the stock in a depot', async () => { - const res = await agent.get(`/depots/${principal}/stock`).query({ date : today }); - helpers.api.listed(res, 3); - - // check the quantites of each individual article - const [ampicilline, oxytocine, quinine] = res.body; - expect(ampicilline.quantity).to.equal(0); - expect(oxytocine.quantity).to.equal(14110); - expect(quinine.quantity).to.equal(360); - }); - let WAC_FROM_PROCEDURE; let WAC_FROM_STOCK_SHEET; @@ -227,4 +216,16 @@ describe('(/depots) The depots API ', () => { }) .catch(helpers.handler); }); + + it('GET /depots/:uuid/stock returns the stock in a depot', async () => { + const res = await agent.get(`/depots/${principal}/stock`).query({ date : today }); + helpers.api.listed(res, 3); + + // check the quantites of each individual article + const [oxytocineLotA, oxytocineLotB, quinine] = res.body; + + expect(oxytocineLotA.quantity).to.equal(9110); + expect(oxytocineLotB.quantity).to.equal(5000); + expect(quinine.quantity).to.equal(360); + }); });