Add More Tests?
nelsonic opened this issue · comments
At present we only have basic tests for this example ...
https://travis-ci.org/dwyl/phoenix-chat-example/jobs/372163015#L659
It's not very "exemplary" if half the app is untested ...
More detail: https://codecov.io/gh/dwyl/phoenix-chat-example
Thinking of adding a few more tests ... anyone up for "pairing" on this?
I've added a couple of extra tests and removed code that is not being used.
Now we're up to 94% which is much better than 59% ... ✅
https://travis-ci.org/dwyl/phoenix-chat-example/builds/373536612#L613
There is only ONE line not being covered:
https://codecov.io/gh/dwyl/phoenix-chat-example/src/b57cc174d7f1c9aac22947f23170b29d4c303776/lib/chat_web.ex#L65
I don't understand how to test this line ...
If it's not being executed I don't understand why removing the __using__
macro crashes the App.
If anyone else
knows how to execute/test this line
I would be super grateful if you can share your wisdom!
Posted question on StackOverflow to try and get to the bottom of this:
https://stackoverflow.com/questions/50124865/why-how-when-to-use-the-using-which-macro-in-phoenix-controller-view-etc
Cross-posted the question to: https://elixirforum.com/t/why-how-when-to-use-the-using-which-macro-in-phoenix-controller-view-etc/14001
Now I go to sleep and in the morning the Wonderful Internet Elves have an answer for me. 😉
Got reply on forum: https://elixirforum.com/t/why-how-when-to-use-the-using-which-macro-in-phoenix-controller-view-etc/14001/2
and StackOverflow: https://stackoverflow.com/a/50127548/1148249
both are useful and I will read the shared links and reply ...
After much searching we concluded that it was not possible to test certain files
so we simple exclude them in the coveralls.json
file:
phoenix-chat-example/coveralls.json
Lines 5 to 8 in 7a09764
We have been using this in all our Phoenix projects.