diff --git a/src/server/test/web/readingsData/expected_line_range_ri_15_mu_kWh_gu_MJ_st_-inf_et_inf b/src/server/test/web/readingsData/expected_line_range_ri_15_mu_kWh_gu_MJ_st_-inf_et_inf new file mode 100644 index 0000000000..2fe07c3188 --- /dev/null +++ b/src/server/test/web/readingsData/expected_line_range_ri_15_mu_kWh_gu_MJ_st_-inf_et_inf @@ -0,0 +1,76 @@ +min,max,start time,end time +24.2133379248197,1428.32317476443,2022-08-18 00:00:00,2022-08-19 00:00:00 +16.119050664482,1424.76568875534,2022-08-19 00:00:00,2022-08-20 00:00:00 +14.5479652470019,1424.03368175126,2022-08-20 00:00:00,2022-08-21 00:00:00 +30.490713559136,1437.84381786877,2022-08-21 00:00:00,2022-08-22 00:00:00 +19.9296980932032,1424.53350607195,2022-08-22 00:00:00,2022-08-23 00:00:00 +44.4133732944417,1410.02306053169,2022-08-23 00:00:00,2022-08-24 00:00:00 +33.4908634563391,1426.67660613797,2022-08-24 00:00:00,2022-08-25 00:00:00 +38.3136807617981,1429.88345782291,2022-08-25 00:00:00,2022-08-26 00:00:00 +59.7592663447959,1422.39278840099,2022-08-26 00:00:00,2022-08-27 00:00:00 +16.4965146487934,1434.28204779374,2022-08-27 00:00:00,2022-08-28 00:00:00 +55.3113264099366,1420.71534751364,2022-08-28 00:00:00,2022-08-29 00:00:00 +22.6460181623561,1389.08426454383,2022-08-29 00:00:00,2022-08-30 00:00:00 +24.7111486803953,1424.02976316808,2022-08-30 00:00:00,2022-08-31 00:00:00 +26.7638037954249,1396.67716100575,2022-08-31 00:00:00,2022-09-01 00:00:00 +42.5565416657884,1438.27357473857,2022-09-01 00:00:00,2022-09-02 00:00:00 +30.0138504475385,1434.84136370308,2022-09-02 00:00:00,2022-09-03 00:00:00 +41.0801203954005,1416.20066712225,2022-09-03 00:00:00,2022-09-04 00:00:00 +56.4554076430806,1399.73577109361,2022-09-04 00:00:00,2022-09-05 00:00:00 +22.9800090632377,1429.38721905183,2022-09-05 00:00:00,2022-09-06 00:00:00 +17.8715589003825,1429.32773109228,2022-09-06 00:00:00,2022-09-07 00:00:00 +27.6320571482923,1372.33665700391,2022-09-07 00:00:00,2022-09-08 00:00:00 +24.2265953783335,1418.52742725134,2022-09-08 00:00:00,2022-09-09 00:00:00 +18.28896430934,1433.27890344784,2022-09-09 00:00:00,2022-09-10 00:00:00 +15.4586612895333,1432.78529139607,2022-09-10 00:00:00,2022-09-11 00:00:00 +26.7794806372737,1438.56281224386,2022-09-11 00:00:00,2022-09-12 00:00:00 +24.2698387242951,1425.51346175417,2022-09-12 00:00:00,2022-09-13 00:00:00 +15.1119515828612,1435.39219383694,2022-09-13 00:00:00,2022-09-14 00:00:00 +25.3414926201664,1433.00262901253,2022-09-14 00:00:00,2022-09-15 00:00:00 +16.4050889585813,1437.95827371531,2022-09-15 00:00:00,2022-09-16 00:00:00 +17.1404171607943,1391.7337551796,2022-09-16 00:00:00,2022-09-17 00:00:00 +17.0453519067413,1434.49147779222,2022-09-17 00:00:00,2022-09-18 00:00:00 +26.8380123304478,1427.52523095974,2022-09-18 00:00:00,2022-09-19 00:00:00 +25.2019174467124,1429.63194620141,2022-09-19 00:00:00,2022-09-20 00:00:00 +26.723268581482,1433.75707397387,2022-09-20 00:00:00,2022-09-21 00:00:00 +34.8204619363771,1434.14919713274,2022-09-21 00:00:00,2022-09-22 00:00:00 +18.5882102804292,1437.07266359572,2022-09-22 00:00:00,2022-09-23 00:00:00 +64.5791328538987,1422.50801593754,2022-09-23 00:00:00,2022-09-24 00:00:00 +21.1011923953181,1438.26089490766,2022-09-24 00:00:00,2022-09-25 00:00:00 +22.2164013850853,1437.41752408918,2022-09-25 00:00:00,2022-09-26 00:00:00 +31.3463301218819,1421.28432810179,2022-09-26 00:00:00,2022-09-27 00:00:00 +22.8546547801585,1403.97238305957,2022-09-27 00:00:00,2022-09-28 00:00:00 +29.6823233903158,1405.2426192015,2022-09-28 00:00:00,2022-09-29 00:00:00 +24.3492609653278,1411.16070889119,2022-09-29 00:00:00,2022-09-30 00:00:00 +32.7913654596471,1436.29999946003,2022-09-30 00:00:00,2022-10-01 00:00:00 +27.9297296688305,1410.45419908998,2022-10-01 00:00:00,2022-10-02 00:00:00 +29.2658636170238,1411.38946022736,2022-10-02 00:00:00,2022-10-03 00:00:00 +23.4756928482669,1424.87019373701,2022-10-03 00:00:00,2022-10-04 00:00:00 +35.5637517598131,1422.43632843012,2022-10-04 00:00:00,2022-10-05 00:00:00 +22.3686314166776,1418.0237212005,2022-10-05 00:00:00,2022-10-06 00:00:00 +18.2873498497805,1411.12147553636,2022-10-06 00:00:00,2022-10-07 00:00:00 +27.6128334186504,1428.10175352685,2022-10-07 00:00:00,2022-10-08 00:00:00 +28.1099872747362,1407.06589166548,2022-10-08 00:00:00,2022-10-09 00:00:00 +17.8680379585646,1434.12338049473,2022-10-09 00:00:00,2022-10-10 00:00:00 +33.1002394424436,1431.83697819436,2022-10-10 00:00:00,2022-10-11 00:00:00 +15.2995262536462,1427.57997828177,2022-10-11 00:00:00,2022-10-12 00:00:00 +27.8766939501474,1437.3721020078,2022-10-12 00:00:00,2022-10-13 00:00:00 +39.25285649377,1435.91261850767,2022-10-13 00:00:00,2022-10-14 00:00:00 +31.0996610777987,1401.80650239463,2022-10-14 00:00:00,2022-10-15 00:00:00 +23.9705055453148,1428.5022838332,2022-10-15 00:00:00,2022-10-16 00:00:00 +31.2463720941955,1434.7245543952,2022-10-16 00:00:00,2022-10-17 00:00:00 +14.742280605685,1425.38635590276,2022-10-17 00:00:00,2022-10-18 00:00:00 +32.3128682290897,1436.23899265725,2022-10-18 00:00:00,2022-10-19 00:00:00 +41.7919578432333,1435.88213852083,2022-10-19 00:00:00,2022-10-20 00:00:00 +21.7274171298471,1430.98561229998,2022-10-20 00:00:00,2022-10-21 00:00:00 +15.5514977787814,1437.62642426354,2022-10-21 00:00:00,2022-10-22 00:00:00 +82.4593054248365,1428.5263009159,2022-10-22 00:00:00,2022-10-23 00:00:00 +15.1368548597767,1414.22090009451,2022-10-23 00:00:00,2022-10-24 00:00:00 +99.8902191429018,1428.2337770847,2022-10-24 00:00:00,2022-10-25 00:00:00 +16.1200173956982,1438.41101960144,2022-10-25 00:00:00,2022-10-26 00:00:00 +14.5666768855453,1434.28431774887,2022-10-26 00:00:00,2022-10-27 00:00:00 +30.7433255513146,1428.98584649714,2022-10-27 00:00:00,2022-10-28 00:00:00 +19.4331584941809,1416.72639161538,2022-10-28 00:00:00,2022-10-29 00:00:00 +65.59074246468,1428.55043110166,2022-10-29 00:00:00,2022-10-30 00:00:00 +31.4206510447809,1433.35403582286,2022-10-30 00:00:00,2022-10-31 00:00:00 +17.6262443956222,1438.6641703876,2022-10-31 00:00:00,2022-11-01 00:00:00 diff --git a/src/server/test/web/readingsLineMeterRangeQuantity.js b/src/server/test/web/readingsLineMeterRangeQuantity.js index 02eb85b7b7..367b510bf1 100644 --- a/src/server/test/web/readingsLineMeterRangeQuantity.js +++ b/src/server/test/web/readingsLineMeterRangeQuantity.js @@ -164,7 +164,52 @@ mocha.describe('readings API', () => { // Add LR10 here - // Add LR11 here + mocha.it( + 'LR11: range should have daily points for 15 minute reading intervals and quantity units with +-inf start/end time & kWh as MJ reverse conversion', + async () => { + const unitDataU = unitDatakWh.concat([ + { + name: 'MJ', + identifier: 'megaJoules', + unitRepresent: Unit.unitRepresentType.QUANTITY, + secInRate: 3600, + typeOfUnit: Unit.unitType.UNIT, + suffix: '', + displayable: Unit.displayableType.ALL, + preferredDisplay: false, + note: 'MJ' + }, + ]); + + // c6 + const unitDataC = conversionDatakWh.concat([ + { + sourceName: 'MJ', + destinationName: 'kWh', + bidirectional: true, + slope: 1/3.6, + intercept: 0, + note: 'MJ → kWh' + }, + ]); + // Prepare test data using existing utility + await prepareTest(unitDataU, unitDataC, meterDatakWh); + //Get unit ID for MJ + const unitId = await getUnitId('MJ'); + //Load the expected data for the LR11 date range and unit configuration + const expected = await parseExpectedCsv( + 'src/server/test/web/readingsData/expected_line_range_ri_15_mu_kWh_gu_MJ_st_-inf_et_inf', + ); + //Send API request using time range and graphic unit + const res = await chai.request(app).get(`/api/unitReadings/line/meters/${METER_ID}`) + .query({ + timeInterval: ETERNITY.toString(), + graphicUnitId: unitId + }); + //Assert the response only includes data within that range and format + expectRangeToEqualExpected(res, expected, METER_ID, 1); + }, + ); // Add LR12 here