Skip to content
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

Completed Test BG10 #1350

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 64 additions & 1 deletion src/server/test/web/readingsBarGroupQuantity.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,70 @@ mocha.describe('readings API', () => {

// Add BG9 here

// Add BG10 here
mocha.it('BG10: 1 day bars for 15 + 20 minute reading intervals and quantity units with +-inf start/end time & kWh as BTU', async () =>{
const unitData = unitDatakWh.concat([
{
// 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([
{
// c2
sourceName: 'kWh',
destinationName: 'MJ',
bidirectional: true,
slope: 3.6,
intercept: 0,
note: 'kWh → MJ'
},
{
// c3
sourceName: 'MJ',
destinationName: 'BTU',
bidirectional: true,
slope: 947.8,
intercept: 0,
note: 'MJ → BTU'
}
]);

//load data into database
await prepareTest(unitData, conversionData, meterDatakWhGroups, groupDatakWh);
//get unit ID since the DB could use any value.
const unitId = await getUnitId('BTU');
// Load the expected response data from the corresponding csv file
const expected = await parseExpectedCsv('src/server/test/web/readingsData/expected_bar_group_ri_15-20_mu_kWh_gu_BTU_st_-inf_et_inf_bd_1.csv');
// Create a request to the API for unbounded reading times and save the response
const res = await chai.request(app).get(`/api/unitReadings/bar/groups/${GROUP_ID}`)
.query({
timeInterval: ETERNITY.toString(),
barWidthDays: '1',
graphicUnitId: unitId });
// Check that the API reading is equal to what it is expected to equal
expectReadingToEqualExpected(res, expected, GROUP_ID);
});

// Add BG11 here

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
reading,start time,end time
29209193.0104336,2022-08-18 00:00:00,2022-08-19 00:00:00
25795589.743482,2022-08-19 00:00:00,2022-08-20 00:00:00
29531280.9199285,2022-08-20 00:00:00,2022-08-21 00:00:00
28972901.8881714,2022-08-21 00:00:00,2022-08-22 00:00:00
28031764.7371833,2022-08-22 00:00:00,2022-08-23 00:00:00
28802134.8350591,2022-08-23 00:00:00,2022-08-24 00:00:00
29089482.1874503,2022-08-24 00:00:00,2022-08-25 00:00:00
28562754.7754511,2022-08-25 00:00:00,2022-08-26 00:00:00
26641697.0795456,2022-08-26 00:00:00,2022-08-27 00:00:00
28730608.5257597,2022-08-27 00:00:00,2022-08-28 00:00:00
28379171.3854016,2022-08-28 00:00:00,2022-08-29 00:00:00
26823146.8172871,2022-08-29 00:00:00,2022-08-30 00:00:00
29302572.2308813,2022-08-30 00:00:00,2022-08-31 00:00:00
28155331.1018422,2022-08-31 00:00:00,2022-09-01 00:00:00
27510358.969585,2022-09-01 00:00:00,2022-09-02 00:00:00
29694622.443881,2022-09-02 00:00:00,2022-09-03 00:00:00
29773433.0568812,2022-09-03 00:00:00,2022-09-04 00:00:00
28472315.1152601,2022-09-04 00:00:00,2022-09-05 00:00:00
26551995.2139845,2022-09-05 00:00:00,2022-09-06 00:00:00
28947223.2033972,2022-09-06 00:00:00,2022-09-07 00:00:00
29063083.5525401,2022-09-07 00:00:00,2022-09-08 00:00:00
27931330.0412951,2022-09-08 00:00:00,2022-09-09 00:00:00
28781046.7149595,2022-09-09 00:00:00,2022-09-10 00:00:00
28364055.9788512,2022-09-10 00:00:00,2022-09-11 00:00:00
30696225.8079846,2022-09-11 00:00:00,2022-09-12 00:00:00
28473699.6649624,2022-09-12 00:00:00,2022-09-13 00:00:00
29283145.4581739,2022-09-13 00:00:00,2022-09-14 00:00:00
27570212.0168767,2022-09-14 00:00:00,2022-09-15 00:00:00
29023763.7911641,2022-09-15 00:00:00,2022-09-16 00:00:00
27852817.1090061,2022-09-16 00:00:00,2022-09-17 00:00:00
29411091.2920606,2022-09-17 00:00:00,2022-09-18 00:00:00
29604980.7864712,2022-09-18 00:00:00,2022-09-19 00:00:00
28154458.5434468,2022-09-19 00:00:00,2022-09-20 00:00:00
31153760.1248859,2022-09-20 00:00:00,2022-09-21 00:00:00
27666463.2860029,2022-09-21 00:00:00,2022-09-22 00:00:00
29795563.315951,2022-09-22 00:00:00,2022-09-23 00:00:00
27360276.2628425,2022-09-23 00:00:00,2022-09-24 00:00:00
27311035.5953025,2022-09-24 00:00:00,2022-09-25 00:00:00
29095555.0733551,2022-09-25 00:00:00,2022-09-26 00:00:00
27726783.808572,2022-09-26 00:00:00,2022-09-27 00:00:00
27508821.5107749,2022-09-27 00:00:00,2022-09-28 00:00:00
28655569.414136,2022-09-28 00:00:00,2022-09-29 00:00:00
29588411.6900755,2022-09-29 00:00:00,2022-09-30 00:00:00
28738147.3845309,2022-09-30 00:00:00,2022-10-01 00:00:00
28123963.9046944,2022-10-01 00:00:00,2022-10-02 00:00:00
28765104.26081,2022-10-02 00:00:00,2022-10-03 00:00:00
27627814.6610993,2022-10-03 00:00:00,2022-10-04 00:00:00
28735441.8490875,2022-10-04 00:00:00,2022-10-05 00:00:00
28285434.407459,2022-10-05 00:00:00,2022-10-06 00:00:00
28929835.0244939,2022-10-06 00:00:00,2022-10-07 00:00:00
29599004.1223681,2022-10-07 00:00:00,2022-10-08 00:00:00
28122739.6885322,2022-10-08 00:00:00,2022-10-09 00:00:00
26479928.0582859,2022-10-09 00:00:00,2022-10-10 00:00:00
28355203.9271451,2022-10-10 00:00:00,2022-10-11 00:00:00
28026344.6838043,2022-10-11 00:00:00,2022-10-12 00:00:00
29621879.1555374,2022-10-12 00:00:00,2022-10-13 00:00:00
29014963.8970632,2022-10-13 00:00:00,2022-10-14 00:00:00
28542153.0589121,2022-10-14 00:00:00,2022-10-15 00:00:00
27600877.2424139,2022-10-15 00:00:00,2022-10-16 00:00:00
28194214.6361847,2022-10-16 00:00:00,2022-10-17 00:00:00
28858052.7695064,2022-10-17 00:00:00,2022-10-18 00:00:00
28153189.1046015,2022-10-18 00:00:00,2022-10-19 00:00:00
27184913.6111465,2022-10-19 00:00:00,2022-10-20 00:00:00
28752720.0055364,2022-10-20 00:00:00,2022-10-21 00:00:00
29298144.0717527,2022-10-21 00:00:00,2022-10-22 00:00:00
27754964.2877268,2022-10-22 00:00:00,2022-10-23 00:00:00
28742598.2237095,2022-10-23 00:00:00,2022-10-24 00:00:00
30205570.981724,2022-10-24 00:00:00,2022-10-25 00:00:00
31181745.6220899,2022-10-25 00:00:00,2022-10-26 00:00:00
27286030.6182213,2022-10-26 00:00:00,2022-10-27 00:00:00
27517284.75375,2022-10-27 00:00:00,2022-10-28 00:00:00
28828155.312223,2022-10-28 00:00:00,2022-10-29 00:00:00
30702649.888834,2022-10-29 00:00:00,2022-10-30 00:00:00
28494727.6464538,2022-10-30 00:00:00,2022-10-31 00:00:00
26683896.1942727,2022-10-31 00:00:00,2022-11-01 00:00:00
Loading