Skip to content

Commit

Permalink
Updated readingsBarMeterFlow.js for B17 test
Browse files Browse the repository at this point in the history
  • Loading branch information
albertfast committed Feb 14, 2025
1 parent 360b24a commit 9a83c3b
Showing 1 changed file with 64 additions and 2 deletions.
66 changes: 64 additions & 2 deletions src/server/test/web/readingsBarMeterFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,70 @@ mocha.describe('readings API', () => {
});
// Check that the API reading is equal to what it is expected to equal
expectReadingToEqualExpected(res, expected);

});

// Add B17 here
mocha.it('B17: should have daily points for 15 minute reading intervals and flow units with +-inf start/end time & kW as kW', async () => {
const unitData = [
{
name: 'kW',
identifier: '',
unitRepresent: Unit.unitRepresentType.FLOW,
secInRate: 3600,
typeOfUnit: Unit.unitType.UNIT,
suffix: '',
displayable: Unit.displayableType.ALL,
preferredDisplay: true,
note: 'kilowatts'
},
{
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 = [
{
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(unitData, conversionData, meterData);
const unitId = await getUnitId('kW');
const expected = await parseExpectedCsv('src/server/test/web/readingsData/expected_bar_ri_15_mu_kW_gu_kW_st_-inf_et_inf_bd_1.csv');
const res = await chai.request(app).get(`/api/unitReadings/bar/meters/${METER_ID}`)
.query({
timeInterval: ETERNITY.toString(),
barWidthDays: 1,
graphicUnitId: unitId
});
expectReadingToEqualExpected(res, expected);
});

// Add B18 here

Expand All @@ -174,7 +236,7 @@ mocha.describe('readings API', () => {
// Add B21 here

// Add B22 here
});

});
});
});
Expand Down

0 comments on commit 9a83c3b

Please sign in to comment.