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

test: [TECH-887] improve rules engine unit test coverage #3462

Merged
merged 8 commits into from
Dec 4, 2023

Conversation

simonadomnisoru
Copy link
Contributor

@simonadomnisoru simonadomnisoru commented Nov 9, 2023

TECH-887

Tech summary

  • Improved the unit tests coverage for:

    • packages/rules-engine
    packages:rules-engine
    • src/core_modules/capture-core/rules folder
    capture-core:rules
  • The first commit is just a format of the test files. Therefore, I recommend that you take a look at the 296c1be commit to visualize the changes more easily.

(cherry picked from commit c86d002)
@simonadomnisoru simonadomnisoru changed the title [TECH-887] test: improve rules engine unit test coverage test: [TECH-887] improve rules engine unit test coverage Nov 9, 2023
@simonadomnisoru simonadomnisoru marked this pull request as ready for review November 10, 2023 10:04
@simonadomnisoru simonadomnisoru requested a review from a team as a code owner November 10, 2023 10:04
@eirikhaugstulen
Copy link
Contributor

Hey @simonadomnisoru!
This is great and I think the test coverage improvements speak for itself.

I do however get a lot of warnings and actually some errors as well when running the tests locally.

image

These errors and warnings are not part of the tests we have in master. Is this something we need to address or is it fine as is?

@simonadomnisoru
Copy link
Contributor Author

simonadomnisoru commented Nov 28, 2023

I do however get a lot of warnings and actually some errors as well when running the tests locally.

These errors and warnings are not part of the tests we have in master. Is this something we need to address or is it fine as is?

Hey @eirikhaugstulen,

Warning and error logs are expected in the console. They are not shown in master because so far we mainly tested the "happy path". In this PR, I added a bunch of test cases where I deliberately tested with invalid data to make sure the input was properly validated and the expected errors were thrown. Let me know if you have any more questions.

Thanks for the review!

Copy link
Contributor

@eirikhaugstulen eirikhaugstulen left a comment

Choose a reason for hiding this comment

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

That makes sense!
I think this change looks good, Simona! 👍

Copy link
Contributor

@superskip superskip left a comment

Choose a reason for hiding this comment

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

Hi @simonadomnisoru! I only have two comments about some changes you made in the rules engine. I haven't looked at the tests you added, mostly because it seems like a frightfully big task to get the overview of what's been implemented and then try to figure out whether the current coverage is satisfactory. It might help with a little more information on the strategy you used to get to this point.

@simonadomnisoru simonadomnisoru merged commit a47e429 into master Dec 4, 2023
36 checks passed
@simonadomnisoru simonadomnisoru deleted the TECH-887-2 branch December 4, 2023 07:32
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 100.47.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants