Skip to content

Commit

Permalink
Merge pull request #1337 from oss-slu/testBG2
Browse files Browse the repository at this point in the history
Test bg2
  • Loading branch information
huss authored Sep 22, 2024
2 parents 46e6921 + 1632fb1 commit 4d233be
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/server/test/web/readingsBarGroupQuantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,22 @@ mocha.describe('readings API', () => {
expectReadingToEqualExpected(res, expected, GROUP_ID);
});

// Add BG2 here
mocha.it('BG2: 7 day bars for 15 + 20 minute reading intervals and quantity units with +-inf start/end time & kWh as kWh', async () =>{
//loads data into database
await prepareTest(unitDatakWh, conversionDatakWh, meterDatakWhGroups, groupDatakWh)
//gets unit ID
const unitId = await getUnitId('kWh');
//load data from mcsv file
const expected = await parseExpectedCsv('src/server/test/web/readingsData/expected_bar_group_ri_15-20_mu_kWh_gu_kWh_st_-inf_et_inf_bd_7.csv')

const res = await chai.request(app).get(`/api/unitReadings/bar/groups/${GROUP_ID}`)
.query({
timeInterval: ETERNITY.toString(),
barWidthDays: '7',
graphicUnitId: unitId });
// Check that the API reading is equal to what it is expected to equal
expectReadingToEqualExpected(res, expected, GROUP_ID);
});


mocha.it('BG3: 28 day bars for 15 + 20 minute reading intervals and quantity units with +-inf start/end time & kWh as kWh', async () =>{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
reading,start time,end time
57744.5416303119,2022-08-23 00:00:00,2022-08-30 00:00:00
58457.1956496669,2022-08-30 00:00:00,2022-09-06 00:00:00
59276.647957841,2022-09-06 00:00:00,2022-09-13 00:00:00
58879.1789750532,2022-09-13 00:00:00,2022-09-20 00:00:00
58647.346330365,2022-09-20 00:00:00,2022-09-27 00:00:00
58324.4920477014,2022-09-27 00:00:00,2022-10-04 00:00:00
58177.8818425628,2022-10-04 00:00:00,2022-10-11 00:00:00
58573.7982237878,2022-10-11 00:00:00,2022-10-18 00:00:00
58642.2652124796,2022-10-18 00:00:00,2022-10-25 00:00:00
58818.8114100034,2022-10-25 00:00:00,2022-11-01 00:00:00

0 comments on commit 4d233be

Please sign in to comment.