Skip to content

Commit

Permalink
Merge pull request #1432 from Phinhas214/C9_test_development
Browse files Browse the repository at this point in the history
C9 test development
  • Loading branch information
huss authored Feb 23, 2025
2 parents dd0cb61 + 8297272 commit 58bef6d
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion src/server/test/web/readingsCompareMeterQuantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,47 @@ mocha.describe('readings API', () => {
expectCompareToEqualExpected(res, expected);
});

// Add C9 here
mocha.it('C9: 1 day shift end 2022-10-31 17:00:00 for 15 minute reading intervals and quantity units & kWh as MJ reverse conversion', async () => {
// add u3 to existing unitData
const unitData = 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'
}
]);
// add c2 to existing conversionData
const conversionData = conversionDatakWh.concat([
{
sourceName: 'MJ',
destinationName: 'kWh',
bidirectional: true,
slope: 1 / 3.6,
intercept: 0,
note: 'MJ → kWh'
}
]);
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];
// for compare, need the unitID, currentStart, currentEnd, shift
const res = await chai.request(app).get(`/api/compareReadings/meters/${METER_ID}`)
.query({
curr_start: '2022-10-31 00:00:00',
curr_end: '2022-10-31 17:00:00',
shift: 'P1D',
graphicUnitId: unitId
});
expectCompareToEqualExpected(res, expected);
});


// Add C10 here

Expand Down

0 comments on commit 58bef6d

Please sign in to comment.