Skip to content
Open
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/readingsLineMeterRangeFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,70 @@ mocha.describe('readings API', () => {
expectRangeToEqualExpected(res, expected)
});

// Add LR26 here
mocha.it('LR26: range should have hourly points for middle readings for 15 minute for a 60 day period and flow units & kW as kW', async () => {
const unitData = [
{
// u4
name: 'Electric',
identifier: '',
unitRepresent: Unit.unitRepresentType.FLOW,
secInRate: 3600,
typeOfUnit: Unit.unitType.METER,
suffix: '',
displayable: Unit.displayableType.NONE,
preferredDisplay: false,
note: 'kilowatts'
},
{
// u5
name: 'kW',
identifier: '',
unitRepresent: Unit.unitRepresentType.FLOW,
secInRate: 3600,
typeOfUnit: Unit.unitType.UNIT,
suffix: '',
displayable: Unit.displayableType.ALL,
preferredDisplay: false,
note: 'special unit' // Not sure if this is correct!
}
];

const conversionData = [
{
// c4
sourceName: 'Electric',
destinationName: 'kW',
bidirectional: false,
slope: 1,
intercept: 0,
note: 'Electric → kW'
}
];

const meterData = [
{
name: 'Electric kW',
unit: 'Electric',
defaultGraphicUnit: 'kW',
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
}
];
await prepareTest(unitData, conversionData, meterData);

const unitId = await getUnitId('kW');

const expected = await parseExpectedCsv('src/server/test/web/readingsData/expected_line_range_ri_15_mu_kW_gu_kW_st_2022-08-25%00#00#00_et_2022-10-24%00#00#00.csv');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the testing document about needing to add any new testing data file. The file specified for reading for the expected values needs to be added to the repository. When I tried to run the test it failed because the file was missing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, generating a new data file. Will update when completed.


const res = await chai.request(app).get(`/api/unitReadings/line/meters/${METER_ID}`)
.query({ timeInterval: ETERNITY.toString(), graphicUnitId: unitId });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the testing document defined the timeInterval to be 2022-08-25 00:00:00 to 2022-10-24 00:00:00 and not infinity.

expectRangeToEqualExpected(res, expected)
});
});
});
});
Expand Down