From b73a2925d48399499fd6cb593fda9ad9b0b327af Mon Sep 17 00:00:00 2001 From: Miller Rosenthal Date: Fri, 6 Dec 2024 03:02:17 +0000 Subject: [PATCH 1/2] test case cg5 --- .../test/web/readingsCompareGroupQuantity.js | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/server/test/web/readingsCompareGroupQuantity.js b/src/server/test/web/readingsCompareGroupQuantity.js index 41b9277de..e04c82196 100644 --- a/src/server/test/web/readingsCompareGroupQuantity.js +++ b/src/server/test/web/readingsCompareGroupQuantity.js @@ -53,10 +53,25 @@ mocha.describe('readings API', () => { }); // Add CG3 here - + // Add CG4 here - - // Add CG5 here + + //Put readings with zero until 2022-11-01 15:00:00 + mocha.it('CG5: 7 day shift end 2022-11-01 15:00:00 (beyond data) for 15 minute reading intervals and quantity units & kWh as kWh ', async () => { + await prepareTest(unitDatakWh, conversionDatakWh, meterDatakWhGroups, groupDatakWh); + // Get the unit ID since the DB could use any value. + const unitId = await getUnitId('kWh'); + const expected = [16171.5504445167, 23010.8509932843]; + // for compare, need the unitID, currentStart, currentEnd, shift + const res = await chai.request(app).get(`/api/compareReadings/groups/${GROUP_ID}`) + .query({ + curr_start: '2022-10-30 00:00:00', + curr_end: '2022-11-01 15:00:00', + shift: 'P7D', + graphicUnitId: unitId + }); + expectCompareToEqualExpected(res, expected, GROUP_ID); + }); // Add CG6 here From e03a467b5045b0a384b5b6fd4b04f80f9371178e Mon Sep 17 00:00:00 2001 From: Miller Rosenthal Date: Fri, 13 Dec 2024 03:18:45 +0000 Subject: [PATCH 2/2] added test case cg5 --- .../test/web/readingsCompareGroupQuantity.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/server/test/web/readingsCompareGroupQuantity.js b/src/server/test/web/readingsCompareGroupQuantity.js index ccb5c5a3b..f26ddf1ef 100644 --- a/src/server/test/web/readingsCompareGroupQuantity.js +++ b/src/server/test/web/readingsCompareGroupQuantity.js @@ -82,7 +82,21 @@ mocha.describe('readings API', () => { expectCompareToEqualExpected(res, expected, GROUP_ID); }); - // Add CG5 here + mocha.it('CG5: 7 day shift end 2022-11-01 15:00:00 (beyond data) for 15 minute reading intervals and quantity units & kWh as kWh ', async () => { + await prepareTest(unitDatakWh, conversionDatakWh, meterDatakWhGroups, groupDatakWh); + // Get the unit ID since the DB could use any value. + const unitId = await getUnitId('kWh'); + const expected = [16171.5504445167, 23010.8509932843]; + // for compare, need the unitID, currentStart, currentEnd, shift + const res = await chai.request(app).get(`/api/compareReadings/groups/${GROUP_ID}`) + .query({ + curr_start: '2022-10-30 00:00:00', + curr_end: '2022-11-01 15:00:00', + shift: 'P7D', + graphicUnitId: unitId + }); + expectCompareToEqualExpected(res, expected, GROUP_ID); + }); // Add CG6 here