-
Notifications
You must be signed in to change notification settings - Fork 16
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
Enhancement/add tests #582
Conversation
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.
Nice! I like it how you are focusing on testing functions with business rules instead of screen flows! +1
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.
🧫
makeInput url = | ||
{ url = url, environment = Flags.Production } | ||
in | ||
describe "when environment is production" |
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.
nice!!
@@ -0,0 +1,130 @@ | |||
module TestHelpers.Fuzz exposing |
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.
i'm curious, where the name fuzz comes from? i've seen "factory" "mocker" "faker" etc, but never fuzz 🤔
maybe i didn't catch the ideia but this is the same concept as those other names right?
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.
I have two answers for you:
Why I chose this name:
Basically to follow the names from the test package. You can see there's TestHelpers.Random
, TestHelpers.Shrink
and TestHelpers.Fuzz
, which then are imported with the aliases Random
, Shrink
and Fuzz
respectively, which are the same names you would use if you were to use the test package directly. These modules just provide Generator
s, Shrinker
s and Fuzzer
s that are specific to our project.
Why it's named like this on the test package:
Probably because of Fuzzing (or fuzz tests), as described in the Test.fuzz documentation, which also mentions other ways this kind of test is called.
(By the way, there's a pretty interesting text about shrinkers here, explaining what they are and how they can help us)
What issue does this PR close
Closes #535
Changes Proposed ( a list of new changes introduced by this PR)
elm-test
to ourpre-push
hookelm-test
to our CI/CD pipeline on githubelm-test
Note: This PR might not cover every single thing that needs testing right now. It's meant to cover some things, and establish examples for future us to use as a reference. This PR adds many tests, but only because we didn't have any tests, so this should be an exception! In order to maintain tests up to date, pull requests after this one should introduce tests alongside their enhancements/features/bug-fixes
How to test ( a list of instructions on how to test this PR)
Well, we can't write tests for tests 😅, so look over the overall structure and organization, check if you agree with it or if we could improve on something. Check if the tests make sense, cover the functions appropriately, and actually pass. Tests should be run on github alongside our other checks, like
elm-review
and build. The actual code of the app shouldn't change (too much), which means we're not really risking breaking the app with this PR