Skip to content

Commit

Permalink
Implemented test LG25.
Browse files Browse the repository at this point in the history
Co-authored-by: Sibyl <yangtingyusibyl@gmail.com>
Co-authored-by: Yumejichi <yumejichi@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 22, 2024
1 parent 81333c4 commit c030015
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
reading,start time,end time
10161.1816667881,2022-08-18 00:00:00,2022-08-19 00:00:00
9127.44700521093,2022-08-19 00:00:00,2022-08-20 00:00:00
10313.5434702251,2022-08-20 00:00:00,2022-08-21 00:00:00
10106.0638077344,2022-08-21 00:00:00,2022-08-22 00:00:00
9825.02987951051,2022-08-22 00:00:00,2022-08-23 00:00:00
10094.4499666174,2022-08-23 00:00:00,2022-08-24 00:00:00
10212.0464463158,2022-08-24 00:00:00,2022-08-25 00:00:00
9935.80210164908,2022-08-25 00:00:00,2022-08-26 00:00:00
9347.09055838198,2022-08-26 00:00:00,2022-08-27 00:00:00
10034.9436616274,2022-08-27 00:00:00,2022-08-28 00:00:00
9945.50643309718,2022-08-28 00:00:00,2022-08-29 00:00:00
9373.27128934282,2022-08-29 00:00:00,2022-08-30 00:00:00
10270.8678827467,2022-08-30 00:00:00,2022-08-31 00:00:00
9848.10335220227,2022-08-31 00:00:00,2022-09-01 00:00:00
9597.85278924242,2022-09-01 00:00:00,2022-09-02 00:00:00
10319.9157892689,2022-09-02 00:00:00,2022-09-03 00:00:00
10427.8608912263,2022-09-03 00:00:00,2022-09-04 00:00:00
9955.16111191153,2022-09-04 00:00:00,2022-09-05 00:00:00
9244.70746098895,2022-09-05 00:00:00,2022-09-06 00:00:00
10124.3383679564,2022-09-06 00:00:00,2022-09-07 00:00:00
10202.7652020235,2022-09-07 00:00:00,2022-09-08 00:00:00
9799.26536614592,2022-09-08 00:00:00,2022-09-09 00:00:00
9997.39438821027,2022-09-09 00:00:00,2022-09-10 00:00:00
9959.34707775718,2022-09-10 00:00:00,2022-09-11 00:00:00
10633.5785307027,2022-09-11 00:00:00,2022-09-12 00:00:00
9948.49211882905,2022-09-12 00:00:00,2022-09-13 00:00:00
10185.2128883045,2022-09-13 00:00:00,2022-09-14 00:00:00
9642.83626269039,2022-09-14 00:00:00,2022-09-15 00:00:00
10117.866164072,2022-09-15 00:00:00,2022-09-16 00:00:00
9749.53625474124,2022-09-16 00:00:00,2022-09-17 00:00:00
10269.8597128079,2022-09-17 00:00:00,2022-09-18 00:00:00
10263.3183533991,2022-09-18 00:00:00,2022-09-19 00:00:00
9917.8351447376,2022-09-19 00:00:00,2022-09-20 00:00:00
10819.5769905014,2022-09-20 00:00:00,2022-09-21 00:00:00
9701.62047519285,2022-09-21 00:00:00,2022-09-22 00:00:00
10392.6725295324,2022-09-22 00:00:00,2022-09-23 00:00:00
9565.85373786866,2022-09-23 00:00:00,2022-09-24 00:00:00
9529.80087167886,2022-09-24 00:00:00,2022-09-25 00:00:00
10161.5199279008,2022-09-25 00:00:00,2022-09-26 00:00:00
9687.9138871263,2022-09-26 00:00:00,2022-09-27 00:00:00
9596.39323496423,2022-09-27 00:00:00,2022-09-28 00:00:00
9976.48447421118,2022-09-28 00:00:00,2022-09-29 00:00:00
10274.8132927885,2022-09-29 00:00:00,2022-09-30 00:00:00
10033.2486598827,2022-09-30 00:00:00,2022-10-01 00:00:00
9828.69542890715,2022-10-01 00:00:00,2022-10-02 00:00:00
10069.6476578376,2022-10-02 00:00:00,2022-10-03 00:00:00
9700.60781071917,2022-10-03 00:00:00,2022-10-04 00:00:00
10005.5026983358,2022-10-04 00:00:00,2022-10-05 00:00:00
9847.78333884939,2022-10-05 00:00:00,2022-10-06 00:00:00
10164.5481162586,2022-10-06 00:00:00,2022-10-07 00:00:00
10285.429774994,2022-10-07 00:00:00,2022-10-08 00:00:00
9825.9784726836,2022-10-08 00:00:00,2022-10-09 00:00:00
9308.96922676591,2022-10-09 00:00:00,2022-10-10 00:00:00
9858.75674722166,2022-10-10 00:00:00,2022-10-11 00:00:00
9807.11776988268,2022-10-11 00:00:00,2022-10-12 00:00:00
10308.9550888055,2022-10-12 00:00:00,2022-10-13 00:00:00
10154.8220141406,2022-10-13 00:00:00,2022-10-14 00:00:00
9940.01906349058,2022-10-14 00:00:00,2022-10-15 00:00:00
9630.47738499758,2022-10-15 00:00:00,2022-10-16 00:00:00
9839.66398104475,2022-10-16 00:00:00,2022-10-17 00:00:00
10050.4417741465,2022-10-17 00:00:00,2022-10-18 00:00:00
9845.12681955118,2022-10-18 00:00:00,2022-10-19 00:00:00
9498.4540901735,2022-10-19 00:00:00,2022-10-20 00:00:00
10089.4380825848,2022-10-20 00:00:00,2022-10-21 00:00:00
10198.5871341644,2022-10-21 00:00:00,2022-10-22 00:00:00
9648.61659756768,2022-10-22 00:00:00,2022-10-23 00:00:00
10027.8222541638,2022-10-23 00:00:00,2022-10-24 00:00:00
10595.7100555942,2022-10-24 00:00:00,2022-10-25 00:00:00
10820.5280789102,2022-10-25 00:00:00,2022-10-26 00:00:00
9529.6015466868,2022-10-26 00:00:00,2022-10-27 00:00:00
9684.37205919273,2022-10-27 00:00:00,2022-10-28 00:00:00
10062.7992837021,2022-10-28 00:00:00,2022-10-29 00:00:00
10623.7237797047,2022-10-29 00:00:00,2022-10-30 00:00:00
9917.46946774952,2022-10-30 00:00:00,2022-10-31 00:00:00
9371.9017677874,2022-10-31 00:00:00,2022-11-01 00:00:00
91 changes: 88 additions & 3 deletions src/server/test/web/readingsLineGroupFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { prepareTest,
// createTimeString,
getUnitId,
ETERNITY,
// METER_ID,
METER_ID,
GROUP_ID,
unitDatakWh,
conversionDatakWh,
Expand All @@ -29,8 +29,93 @@ mocha.describe('readings API', () => {

// Add LG8 here

// Add LG25 here

mocha.it(
"LG25: should have daily points for 15 + 20 minute reading intervals and flow units with +-inf start/end time & thing as thing where rate is 36",
async () => {
const unitData = [
{
name: 'Thing_36',
identifier: '',
unitRepresent: Unit.unitRepresentType.FLOW,
secInRate: 36,
typeOfUnit: Unit.unitType.METER,
suffix: '',
displayable: Unit.displayableType.NONE,
preferredDisplay: false,
note: 'special unit'
},
{
name: 'thing unit',
identifier: '',
unitRepresent: Unit.unitRepresentType.FLOW,
secInRate: 3600,
typeOfUnit: Unit.unitType.UNIT,
suffix: '',
displayable: Unit.displayableType.ALL,
preferredDisplay: false,
note: 'special unit'
}
];
const conversionData = [
{
sourceName: 'Thing_36',
destinationName: 'thing unit',
bidirectional: false,
slope: 1,
intercept: 0,
note: 'Thing_36 → thing unit'
}
];
const meterData = [
{
name: 'Thing_36 thing unit',
unit: 'Thing_36',
defaultGraphicUnit: 'thing unit',
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
},
{
name: 'Thing_36 Other',
unit: 'Thing_36',
defaultGraphicUnit: 'thing unit',
displayable: true,
gps: undefined,
note: 'special meter',
file: 'test/web/readingsData/readings_ri_20_days_75.csv',
deleteFile: false,
readingFrequency: '20 minutes',
id: (METER_ID + 1)
}
];
const groupData = [
{
id: GROUP_ID,
name: 'Thing_36 thing unit + Other',
displayable: true,
note: 'special group',
defaultGraphicUnit: 'thing unit',
childMeters: ['Thing_36 thing unit', 'Thing_36 Other'],
childGroups: [],
}
]
// Load the data into the database
await prepareTest(unitData, conversionData, meterData, groupData);
// Get the unit ID since the DB could use any value.
const unitId = await getUnitId('thing unit');
// Load the expected response data from the corresponding csv file
const expected = await parseExpectedCsv('src/server/test/web/readingsData/expected_line_group_ri_15-20_mu_Thing36_gu_thing_st_-inf_et_inf.csv');
// Create a request to the API for unbounded reading times and save the response
const res = await chai.request(app).get(`/api/unitReadings/line/groups/${GROUP_ID}`)
.query({ timeInterval: ETERNITY.toString(), graphicUnitId: unitId });
// Check that the API reading is equal to what it is expected to equal
expectReadingToEqualExpected(res, expected, GROUP_ID);
}
);
});
});
});
Expand Down

0 comments on commit c030015

Please sign in to comment.