-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Final test C10 #1431
base: development
Are you sure you want to change the base?
Final test C10 #1431
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,7 +156,99 @@ mocha.describe('readings API', () => { | |
|
||
// Add C9 here | ||
|
||
// Add C10 here | ||
mocha.it('C10: 1 day shift end 2022-10-31 17:00:00 for 15 minute reading intervals and quantity units & kWh as BTU', async () => { | ||
// Use predefined unit and conversion data | ||
const unitData = unitDatakWh.concat([ | ||
//adding u1, u2, u3, u16 | ||
{ //u1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OED prefers not to have comments at the end of the line. Could you move these (this one will be removed but for later ones) to the next line above the code being described. |
||
name: 'kWh', | ||
identifier: '', | ||
unitRepresent: Unit.unitRepresentType.QUANTITY, | ||
secInRate: 3600, | ||
typeOfUnit: Unit.unitType.UNIT, | ||
suffix: '', | ||
displayable: Unit.displayableType.ALL, | ||
preferredDisplay: false, | ||
note: 'OED created standard unit' | ||
}, | ||
{ //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, | ||
secInRate: 3600, | ||
typeOfUnit: Unit.unitType.UNIT, | ||
suffix: '', | ||
displayable: Unit.displayableType.ALL, | ||
preferredDisplay: false, | ||
note: 'MJ' | ||
}, | ||
{ // u16 | ||
name: 'BTU', | ||
identifier: '', | ||
unitRepresent: Unit.unitRepresentType.QUANTITY, | ||
secInRate: 3600, | ||
typeOfUnit: Unit.unitType.UNIT, | ||
suffix: '', | ||
displayable: Unit.displayableType.ALL, | ||
preferredDisplay: true, | ||
note: 'OED created standard unit' | ||
} | ||
]); | ||
const conversionData = conversionDatakWh.concat([ | ||
// adding c1, c2, c3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As with units, c1 is already defined and should not be added here. |
||
{ // 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: 'MJ → BTU' | ||
}, | ||
{ //c3 | ||
sourceName: 'MJ', | ||
destinationName: 'BTU', | ||
bidirectional: true, | ||
slope: 947.8, | ||
intercept: 0, | ||
note: 'MJ → BTU' | ||
} | ||
]); | ||
|
||
// load data into database | ||
await prepareTest(unitData, conversionData, meterDatakWh); | ||
|
||
// Get the unit ID since the DB could use any value | ||
const unitId = await getUnitId('BTU'); | ||
const expected = [10645752.224022, 11490184.2415072]; | ||
// 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 C11 here | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u1 & u2 are defined in
unitDataKWh
and should not be redefined here. u3 & u16 should be concat here to define. The test case is failing on my machine and this is the reason why.