diff --git a/src/server/test/web/readingsBarMeterFlow.js b/src/server/test/web/readingsBarMeterFlow.js index a8380c6b5..419103331 100644 --- a/src/server/test/web/readingsBarMeterFlow.js +++ b/src/server/test/web/readingsBarMeterFlow.js @@ -25,11 +25,60 @@ mocha.describe('readings API', () => { mocha.describe('for bar charts', () => { mocha.describe('for flow meters', () => { - // Add B15 here - /* mocha.it('B15: should have daily points for 15 minute reading intervals and flow units with +-inf start/end time & kW as kW', async () => { + const unitData = [ + { + // u4 + name: 'kW', + identifier: '', + unitRepresent: Unit.unitRepresentType.FLOW, + secInRate: 3600, + typeOfUnit: Unit.unitType.UNIT, + suffix: '', + displayable: Unit.displayableType.ALL, + preferredDisplay: true, + note: 'kilowatts' + }, + { + // u5 + name: 'Electric', + identifier: '', + unitRepresent: Unit.unitRepresentType.FLOW, + secInRate: 3600, + typeOfUnit: Unit.unitType.METER, + suffix: '', + displayable: Unit.displayableType.NONE, + preferredDisplay: false, + note: 'special unit' + } + ]; + const conversionData = [ + { + // c4 + sourceName: 'Electric', + destinationName: 'kW', + bidirectional: false, + slope: 1, + intercept: 0, + note: 'Electric → kW' + } + ]; + const meterData = [ + { + name: 'Electric kW', + unit: 'Electric', + defaultGraphicUnit: 'kW', + displayable: true, + gps: undefined, + note: 'special meter', + file: 'test/web/readingsData/readings_ri_15_days_75.csv', + deleteFile: false, + readingFrequency: '15 minutes', + id: METER_ID + } + ]; // Load the data into the database - await prepareTest(unitDatakWh, conversionDatakWh, meterDatakWh); + await prepareTest(unitData, conversionData, meterData); // Get the unit ID since the DB could use any value. const unitId = await getUnitId('kW'); // Load the expected response data from the corresponding csv file @@ -44,8 +93,7 @@ mocha.describe('readings API', () => { // Check that the API reading is equal to what it is expected to equal expectReadingToEqualExpected(res, expected); }); - */ - + // Add B16 here }); diff --git a/src/server/test/web/readingsData/expected_bar_ri_15_mu_kW_gu_kW_st_-inf_et_inf_bd_13.csv b/src/server/test/web/readingsData/expected_bar_ri_15_mu_kW_gu_kW_st_-inf_et_inf_bd_13.csv new file mode 100644 index 000000000..525ec4235 --- /dev/null +++ b/src/server/test/web/readingsData/expected_bar_ri_15_mu_kW_gu_kW_st_-inf_et_inf_bd_13.csv @@ -0,0 +1,6 @@ +reading,start time,end time +15301.1498675756,2022-08-28 00:00:00,2022-09-10 00:00:00 +15751.2507459568,2022-09-10 00:00:00,2022-09-23 00:00:00 +15351.7660820708,2022-09-23 00:00:00,2022-10-06 00:00:00 +15396.6227909537,2022-10-06 00:00:00,2022-10-19 00:00:00 +15560.3449027915,2022-10-19 00:00:00,2022-11-01 00:00:00