Skip to content

test(LR18): add kg CO₂ range conversion integration test#1627

Open
johnny603 wants to merge 5 commits into
OpenEnergyDashboard:developmentfrom
johnny603:testReadings/962/LR18
Open

test(LR18): add kg CO₂ range conversion integration test#1627
johnny603 wants to merge 5 commits into
OpenEnergyDashboard:developmentfrom
johnny603:testReadings/962/LR18

Conversation

@johnny603
Copy link
Copy Markdown

@johnny603 johnny603 commented May 21, 2026

Description

Followed design of other test cases in the

Part of #962 fix

Type of change

Adds a test case

Checklist

(Note what you have done by placing an "x" instead of the space in the [ ] so it becomes [x]. It is hoped you do all of them.)

  • I have followed the OED pull request ideas
  • I have removed text in ( ) from the issue request
  • You acknowledge that every person contributing to this work has signed the OED Contributing License Agreement and each author is listed in the Description section.

Limitations

(Describe any issues that remain or work that should still be done.)

Contributors

@johnny603
@madisontran16

@johnny603 johnny603 changed the title fix: LR18 Expected Value (WIP) Fix: LR18 Expected Value (WIP) May 21, 2026
@johnny603 johnny603 changed the title Fix: LR18 Expected Value (WIP) test(LR18): expected values (WIP) May 23, 2026
@huss
Copy link
Copy Markdown
Member

huss commented May 25, 2026

@johnny603 & @madisontran16 I'm assuming you will remove the Draft/WIP from this PR when it is ready for review. If you want me to look at it without doing that then please put in a comment. I just wanted to be clear that I'm not looking at the work at this point. If you need anything then please let me know.

@johnny603 johnny603 changed the title test(LR18): expected values (WIP) test(LR18): expected values May 25, 2026
@johnny603 johnny603 marked this pull request as ready for review May 25, 2026 20:01
@johnny603
Copy link
Copy Markdown
Author

@johnny603 & @madisontran16 I'm assuming you will remove the Draft/WIP from this PR when it is ready for review. If you want me to look at it without doing that then please put in a comment. I just wanted to be clear that I'm not looking at the work at this point. If you need anything then please let me know.

Hi, the LR18 changes are now ready for review, so we’ll be removing the Draft/WIP status from the PR shortly.

This update ended up being a bit different from LR1–LR7 because LR18 validates unit conversion behavior in addition to aggregation behavior. Instead of only testing kWh → kWh responses, LR18 required seeding custom conversion fixtures and validating output in kg CO₂.

Main updates made:

  • Added custom unit fixtures for Electric_Utility, kg, and kg CO₂

  • Added conversion fixtures for:

    • Electric_Utility → kg CO₂
    • kg CO₂ → kg
  • Updated the test to request the converted graphic unit instead of the source unit

  • Added/validated the expected CSV for the converted range output

  • Verified the test independently with Mocha before pushing

A few questions while reviewing:

  1. Does the custom fixture setup for LR18 look consistent with the intended testing pattern for conversion-based range tests?
  2. Would you prefer these CO₂ conversion fixtures to stay local to LR18, or should they be abstracted into shared test utilities similar to the kWh helpers?
  3. Since LR18 introduces conversion-specific setup beyond LR1–LR7, would you recommend matching the existing naming/comments more closely with L18 in readingsLineMeterQuantity.js for consistency?

Thanks!

@johnny603 johnny603 changed the title test(LR18): expected values test(LR18): add kg CO₂ range conversion integration test May 25, 2026
@huss
Copy link
Copy Markdown
Member

huss commented May 25, 2026

@madisontran16 You are a contributor to this PR and the CLA box is checked but I did not see you in the OED records. Can you please either do the CLA or let me know if you think our records are off.

Copy link
Copy Markdown
Member

@huss huss left a comment

Choose a reason for hiding this comment

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

@johnny603 & @madisontran16 Thank you for this contribution to OED. Review and testing found it works as expected. I made one small comment within the code to consider. Also, I could not easily comment in this file so I am putting this comment here:

The directory (I think) OED is showing as a change in this PR. I'm not sure what this file is for but I think it should be removed from the PR.

As for your questions, this test does need different units/conversions than the other tests in the file. This is done in many of these test files and it is done the way you did it so your setup is fine. Specifically, the names in other tests may vary and that is fine. Also, since these tests are not as common, OED chose not to abstract the unit/conversion/meter definitions into a central. This was also done because they are often different between the tests.

Please let me know if anything is not clear or you have thoughts/questions.

Comment on lines +5 to +6
/* eslint-disable @typescript-eslint/no-var-requires, no-undef, @typescript-eslint/indent, comma-dangle, max-len */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure why the eslint-disable was added. I removed it and did not see any compile issues. Given this, I think these two new lines should be removed unless you feel otherwise.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@johnny603 I see you gave this a thumbs up and resolved this comment. However, I don't see a change for this. Am I missing something? Do you think it should stay? I unresolved this comment for now.

@johnny603 johnny603 requested a review from huss May 26, 2026 16:14
@johnny603
Copy link
Copy Markdown
Author

@johnny603 & @madisontran16 Thank you for this contribution to OED. Review and testing found it works as expected. I made one small comment within the code to consider. Also, I could not easily comment in this file so I am putting this comment here:

The directory (I think) OED is showing as a change in this PR. I'm not sure what this file is for but I think it should be removed from the PR.

As for your questions, this test does need different units/conversions than the other tests in the file. This is done in many of these test files and it is done the way you did it so your setup is fine. Specifically, the names in other tests may vary and that is fine. Also, since these tests are not as common, OED chose not to abstract the unit/conversion/meter definitions into a central. This was also done because they are often different between the tests.

Please let me know if anything is not clear or you have thoughts/questions.

I verified with

git diff origin/development...HEAD --stat

Should be removed now, thanks for pointing that out

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants