Skip to content

Commit

Permalink
Edited test case to match comment on pull request.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderORuban committed Nov 29, 2024
1 parent 7a31716 commit 6e8fea1
Showing 1 changed file with 7 additions and 56 deletions.
63 changes: 7 additions & 56 deletions src/server/test/web/readingsCompareMeterQuantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,34 +75,9 @@ mocha.describe('readings API', () => {
// Add C6 here

mocha.it('C8: 1 day shift end 2022-10-31 17:00:00 for 15 minute reading intervals and quantity units & kWh as MJ', async () => {
// adding units u1, u2, u3
const unitData = [
{
// u1
name: 'kWh',
identifier: '',
unitRepresent: Unit.unitRepresentType.QUANTITY,
secInRate: 3600,
typeOfUnit: Unit.unitType.UNIT,
suffix: '',
displayable: Unit.displayableType.ALL,
preferredDisplay: true,
note: 'OED created standard unit'
},
// Use predefined unit and conversion data
const unitData = unitDatakWh.concat([
{
// u2
name: 'Electric_Utility',
identifier: '',
unitRepresent: Unit.unitRepresentType.QUANTITY,
secInRate: 3600,
typeOfUnit: Unit.unitType.METER,
suffix: '',
displayable: Unit.displayableType.NONE,
preferredDisplay: false,
note: 'special unit'
},
{
// u3
name: 'MJ',
identifier: 'megaJoules',
unitRepresent: Unit.unitRepresentType.QUANTITY,
Expand All @@ -113,43 +88,19 @@ mocha.describe('readings API', () => {
preferredDisplay: false,
note: 'MJ'
}
];
const conversionData = [
// adding conversions c1, c2
]);
const conversionData = conversionDatakWh.concat([
{
// c1
sourceName: 'Electric_Utility',
destinationName: 'kWh',
bidirectional: false,
slope: 1,
intercept: 0,
note: 'Electric_Utility → kWh'
},
{
// c2
sourceName: 'kWh',
destinationName: 'MJ',
bidirectional: true,
slope: 3.6,
intercept: 0,
note: 'kWh → MJ'
}
];
const meterData = [
// adding meterData for MJ Unit
{
name: 'Electric_Utility MJ',
unit: 'Electric_Utility',
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
}
];
await prepareTest(unitData, conversionData, meterData);
]);
// Prepare test with the standard data
await prepareTest(unitData, conversionData, meterDatakWh);
// Get the unit ID since the DB could use any value.
const unitId = await getUnitId('MJ');
const expected = [11232.0660730344, 12123.0051081528];
Expand Down

0 comments on commit 6e8fea1

Please sign in to comment.