-
Notifications
You must be signed in to change notification settings - Fork 458
Add test for hourly points in range with flow units #1576
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
Open
AndrewKam123
wants to merge
2
commits into
OpenEnergyDashboard:development
Choose a base branch
from
AndrewKam123:development
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+64
−1
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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'); | ||
|
|
||
| const res = await chai.request(app).get(`/api/unitReadings/line/meters/${METER_ID}`) | ||
| .query({ timeInterval: ETERNITY.toString(), graphicUnitId: unitId }); | ||
|
Member
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. 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) | ||
| }); | ||
| }); | ||
| }); | ||
| }); | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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.
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.
Okay, generating a new data file. Will update when completed.