diff --git a/src/server/test/web/readingsCompareGroupQuantity.js b/src/server/test/web/readingsCompareGroupQuantity.js index 2f3f6ceb6..41b9277de 100644 --- a/src/server/test/web/readingsCompareGroupQuantity.js +++ b/src/server/test/web/readingsCompareGroupQuantity.js @@ -14,14 +14,14 @@ const { prepareTest, unitDatakWh, conversionDatakWh, meterDatakWhGroups, - groupDatakWh } = require('../../util/readingsUtils'); + groupDatakWh } = require('../../util/readingsUtils'); mocha.describe('readings API', () => { mocha.describe('readings test, test if data returned by API is as expected', () => { mocha.describe('for compare charts', () => { mocha.describe('for groups', () => { // Test 15 minutes over all time for flow unit. - mocha.it(' 1 day shift end 2022-10-31 17:00:00 for 15 minute reading intervals and quantity units & kWh as kWh ', async () => { + mocha.it('CG1: 1 day shift end 2022-10-31 17:00:00 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'); @@ -36,8 +36,21 @@ mocha.describe('readings API', () => { }); expectCompareToEqualExpected(res, expected, GROUP_ID); }); - - // Add CG2 here + mocha.it('CG2: 7 day shift end 2022-10-31 17:00:00 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 = [14017.4841100155, 14605.4957015091]; + // 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-10-31 17:00:00', + shift: 'P7D', + graphicUnitId: unitId + }); + expectCompareToEqualExpected(res, expected, GROUP_ID); + }); // Add CG3 here