-
Notifications
You must be signed in to change notification settings - Fork 34
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(search): improve test coverage #48
Conversation
Is this still in draft or are you okay with not covering line 65? |
I was expecting to land this since I did not find an easy way to cover that line: Lines 61 to 69 in d054a71
It depends on |
I would use https://www.npmjs.com/package/mock-require |
Working with your package proposal and so far so good. With current mocked Coverage for Line 26Lines 23 to 27 in d054a71
Checking the code and the possible values in (strange because with previous version of my tests I made it to cover this line but I don't know exactly how 🙄) Coverage for Line 65Lines 61 to 80 in d054a71
According to the invocation of Line 94 in d054a71
I think there is no path of execution where line 65 can be falsy so that it stops execution there. Could that be possible? If so, do you have any example where that could happen, so I can reproduce it in the mock? Thanks for your support and help here :) |
Maybe @Glennmen can help answer this question. It was added by 2973921
I believe the thinking is that if one searches for "baz" then it will short circuit and not attempt to add any search results for Alfred to display. |
The logic I got for the skintone modifier came from: https://github.com/muan/mojibar/blob/3a1dac0998202e8425a63acb37da82aa7d6385f9/app/search.js#L225 Not sure about line 65 through, can't remember if I actually checked if that is ever triggered. alfred-emoji/test/search.test.js Lines 24 to 28 in d054a71
It has been a while sorry 😅 if there is something else I can help with please let me know. |
Finally found the use case for L26 🥳 |
To make test to cover L65 and do not fail for the rest I had to add an extreme use case:
To avoid exploding for the rest of tests, I had to add an extra defensive programming statement:
|
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.
Fantastic. Thank you for sticking with this.
📝 Summary
⛱ Motivation and Context
To reach 100% test coverage