diff --git a/src/server/test/web/readingsData/expected_line_group_ri_15-20_mu_kWh_gu_kWh_st_2022-08-25%00#00#00_et_2022-10-25%00#00#00.csv b/src/server/test/web/readingsData/expected_line_group_ri_15-20_mu_kWh_gu_kWh_st_2022-08-25%00#00#00_et_2022-10-25%00#00#00.csv new file mode 100644 index 000000000..ef38cae7a --- /dev/null +++ b/src/server/test/web/readingsData/expected_line_group_ri_15-20_mu_kWh_gu_kWh_st_2022-08-25%00#00#00_et_2022-10-25%00#00#00.csv @@ -0,0 +1,62 @@ +reading,start time,end time +348.794513115302,2022-08-25 00:00:00,2022-08-26 00:00:00 +325.335487927521,2022-08-26 00:00:00,2022-08-27 00:00:00 +350.844261732821,2022-08-27 00:00:00,2022-08-28 00:00:00 +346.552681763538,2022-08-28 00:00:00,2022-08-29 00:00:00 +327.551264151768,2022-08-29 00:00:00,2022-08-30 00:00:00 +357.828805192157,2022-08-30 00:00:00,2022-08-31 00:00:00 +343.819252746152,2022-08-31 00:00:00,2022-09-01 00:00:00 +335.943165771623,2022-09-01 00:00:00,2022-09-02 00:00:00 +362.616332313929,2022-09-02 00:00:00,2022-09-03 00:00:00 +363.578729309801,2022-09-03 00:00:00,2022-09-04 00:00:00 +347.690107833297,2022-09-04 00:00:00,2022-09-05 00:00:00 +324.240092235828,2022-09-05 00:00:00,2022-09-06 00:00:00 +353.489455153909,2022-09-06 00:00:00,2022-09-07 00:00:00 +354.904285564574,2022-09-07 00:00:00,2022-09-08 00:00:00 +341.083860398143,2022-09-08 00:00:00,2022-09-09 00:00:00 +351.460188445165,2022-09-09 00:00:00,2022-09-10 00:00:00 +346.368099747212,2022-09-10 00:00:00,2022-09-11 00:00:00 +374.84742698472,2022-09-11 00:00:00,2022-09-12 00:00:00 +347.707015282985,2022-09-12 00:00:00,2022-09-13 00:00:00 +357.591574862619,2022-09-13 00:00:00,2022-09-14 00:00:00 +336.674062166342,2022-09-14 00:00:00,2022-09-15 00:00:00 +354.424131702218,2022-09-15 00:00:00,2022-09-16 00:00:00 +340.125098534791,2022-09-16 00:00:00,2022-09-17 00:00:00 +359.153987353518,2022-09-17 00:00:00,2022-09-18 00:00:00 +361.521671854988,2022-09-18 00:00:00,2022-09-19 00:00:00 +343.808597486074,2022-09-19 00:00:00,2022-09-20 00:00:00 +380.434614234401,2022-09-20 00:00:00,2022-09-21 00:00:00 +337.849435998996,2022-09-21 00:00:00,2022-09-22 00:00:00 +363.848973304052,2022-09-22 00:00:00,2022-09-23 00:00:00 +334.110428522124,2022-09-23 00:00:00,2022-09-24 00:00:00 +333.50912536369,2022-09-24 00:00:00,2022-09-25 00:00:00 +355.300812033461,2022-09-25 00:00:00,2022-09-26 00:00:00 +338.586040975154,2022-09-26 00:00:00,2022-09-27 00:00:00 +335.924391070047,2022-09-27 00:00:00,2022-09-28 00:00:00 +349.927920483205,2022-09-28 00:00:00,2022-09-29 00:00:00 +361.319338083069,2022-09-29 00:00:00,2022-09-30 00:00:00 +350.936322621037,2022-09-30 00:00:00,2022-10-01 00:00:00 +343.436211742476,2022-10-01 00:00:00,2022-10-02 00:00:00 +351.265506924539,2022-10-02 00:00:00,2022-10-03 00:00:00 +337.377477729851,2022-10-03 00:00:00,2022-10-04 00:00:00 +350.903283933938,2022-10-04 00:00:00,2022-10-05 00:00:00 +345.408011235803,2022-10-05 00:00:00,2022-10-06 00:00:00 +353.277119143528,2022-10-06 00:00:00,2022-10-07 00:00:00 +361.448687730652,2022-10-07 00:00:00,2022-10-08 00:00:00 +343.421262208245,2022-10-08 00:00:00,2022-10-09 00:00:00 +323.360043071063,2022-10-09 00:00:00,2022-10-10 00:00:00 +346.260002783555,2022-10-10 00:00:00,2022-10-11 00:00:00 +342.24413314611,2022-10-11 00:00:00,2022-10-12 00:00:00 +361.728026545115,2022-10-12 00:00:00,2022-10-13 00:00:00 +354.316671661948,2022-10-13 00:00:00,2022-10-14 00:00:00 +348.542934941347,2022-10-14 00:00:00,2022-10-15 00:00:00 +337.04853103305,2022-10-15 00:00:00,2022-10-16 00:00:00 +344.294079615473,2022-10-16 00:00:00,2022-10-17 00:00:00 +352.400549048117,2022-10-17 00:00:00,2022-10-18 00:00:00 +343.793095714363,2022-10-18 00:00:00,2022-10-19 00:00:00 +331.968984841437,2022-10-19 00:00:00,2022-10-20 00:00:00 +351.114276403449,2022-10-20 00:00:00,2022-10-21 00:00:00 +357.774730659802,2022-10-21 00:00:00,2022-10-22 00:00:00 +338.930167323729,2022-10-22 00:00:00,2022-10-23 00:00:00 +350.990674111167,2022-10-23 00:00:00,2022-10-24 00:00:00 +368.855788132704,2022-10-24 00:00:00,2022-10-25 00:00:00 \ No newline at end of file diff --git a/src/server/test/web/readingsLineGroupQuantity.js b/src/server/test/web/readingsLineGroupQuantity.js index 61f03020d..88e59140a 100644 --- a/src/server/test/web/readingsLineGroupQuantity.js +++ b/src/server/test/web/readingsLineGroupQuantity.js @@ -12,7 +12,7 @@ const Unit = require('../../models/Unit'); const { prepareTest, parseExpectedCsv, expectReadingToEqualExpected, - // createTimeString, + createTimeString, getUnitId, ETERNITY, // METER_ID, @@ -42,8 +42,20 @@ mocha.describe('readings API', () => { }); // Add LG2 here - - // Add LG3 here + + mocha.it('LG3: should have daily points for middle readings of 15 + 20 minute for a 61 day period and quantity units with kWh as kWh', async () => { + // Load the data into the database + await prepareTest(unitDatakWh, conversionDatakWh, meterDatakWhGroups, groupDatakWh); + // Get the unit ID since the DB could use any value. + const unitId = await getUnitId('kWh'); + // Load the expected response data from the corresponding csv file + const expected = await parseExpectedCsv('src/server/test/web/readingsData/expected_line_group_ri_15-20_mu_kWh_gu_kWh_st_2022-08-25%00#00#00_et_2022-10-25%00#00#00.csv'); + // Create a request to the API for unbounded reading times and save the response + const res = await chai.request(app).get(`/api/unitReadings/line/groups/${GROUP_ID}`) + .query({ timeInterval: createTimeString('2022-08-25', '00:00:00', '2022-10-25', '00:00:00'), graphicUnitId: unitId }); + // Check that the API reading is equal to what it is expected to equal + expectReadingToEqualExpected(res, expected, GROUP_ID); + }); // Add LG4 here