Skip to content

Commit

Permalink
Merge pull request #1394 from qopci/c8_madeleine
Browse files Browse the repository at this point in the history
Completed C8 Test Case
  • Loading branch information
huss authored Nov 29, 2024
2 parents c7c25cf + 6e8fea1 commit 82a74d6
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion src/server/test/web/readingsCompareMeterQuantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,46 @@ mocha.describe('readings API', () => {

// Add C6 here

// Add C8 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 () => {
// Use predefined unit and conversion data
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'
}
]);
const conversionData = conversionDatakWh.concat([
{
sourceName: 'kWh',
destinationName: 'MJ',
bidirectional: true,
slope: 3.6,
intercept: 0,
note: 'kWh → MJ'
}
]);
// 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];
// 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 C9 here

Expand Down

0 comments on commit 82a74d6

Please sign in to comment.