Closed nelsonic closed 2 years ago
Going through the test coverage report in the browser we can see that /auth/cover/excoveralls.html#lib/auth/log.ex
has an uncovered guard function:
Which caused me to ask the question:
stringify/1
inside the Auth.Log
module...? 🤷♂️I'm sure this made sense to 2-years ago Nelson ... 🙄 ⏳
https://github.com/dwyl/auth/blame/f6a72102fd72f99ba8c42d00083e22c2fdec917a/lib/auth/log.ex#L134
But this feels like it belongs in our Useful
utility library instead
so that it can be independently tested, documented and re-used in other projects! ♻️
#brb
Created PR: https://github.com/dwyl/useful/pull/26
Next in lib/auth/person.ex
there is one line that isn't covered:
Can't that I know how I'm going to test this ... 💭
Added test:
test "Auth.Person.decrypt_email/1" do
email = "alex@gmail.com"
encrypted = email |> Fields.AES.encrypt() |> Base58.encode()
decrypted = Person.decrypt_email(encrypted)
assert email == decrypted
# Unhappy ("rescue") path:
invalid_email = ""
assert Person.decrypt_email(invalid_email) == 0
end
Last one in lib/auth_web/auth_controller.ex
...
defp client_id_is_current?
... yay trying to test a private function! 🎉 (🙄 ...)
No idea why/how these lines were not being reported as uncovered by tests in previous builds ... 🤷♂️ But they are now all covered. ✅
Finished in 16.9 seconds (16.9s async, 0.00s sync)
1 property, 152 tests, 0 failures
Randomized with seed 231724
----------------
COV FILE LINES RELEVANT MISSED
100.0% lib/auth.ex 9 0 0
100.0% lib/auth/apikey.ex 105 15 0
100.0% lib/auth/app.ex 158 17 0
100.0% lib/auth/email.ex 41 7 0
100.0% lib/auth/init/init.ex 124 26 0
100.0% lib/auth/init/roles.ex 69 3 0
100.0% lib/auth/init/statuses.ex 113 3 0
100.0% lib/auth/log.ex 125 25 0
100.0% lib/auth/people_roles.ex 136 12 0
100.0% lib/auth/permission.ex 120 8 0
100.0% lib/auth/person.ex 373 58 0
100.0% lib/auth/repo.ex 5 0 0
100.0% lib/auth/role.ex 212 30 0
100.0% lib/auth/session.ex 105 16 0
100.0% lib/auth/status.ex 46 8 0
100.0% lib/auth/user_agent.ex 101 25 0
100.0% lib/auth_web/controllers/api_controller. 70 19 0
100.0% lib/auth_web/controllers/app_controller. 111 36 0
100.0% lib/auth_web/controllers/auth_controller 507 141 0
100.0% lib/auth_web/controllers/init_controller 45 7 0
100.0% lib/auth_web/controllers/people_controll 34 8 0
100.0% lib/auth_web/controllers/permission_cont 61 19 0
100.0% lib/auth_web/controllers/ping_controller 8 1 0
100.0% lib/auth_web/controllers/role_controller 192 67 0
100.0% lib/auth_web/endpoint.ex 54 0 0
100.0% lib/auth_web/gettext.ex 24 0 0
100.0% lib/auth_web/plugs/is_owner.ex 12 1 0
100.0% lib/auth_web/router.ex 103 25 0
100.0% lib/auth_web/views/app_view.ex 3 0 0
100.0% lib/auth_web/views/auth_view.ex 3 0 0
100.0% lib/auth_web/views/error_view.ex 30 4 0
100.0% lib/auth_web/views/init_view.ex 3 0 0
100.0% lib/auth_web/views/layout_view.ex 3 0 0
100.0% lib/auth_web/views/people_view.ex 35 7 0
100.0% lib/auth_web/views/permission_view.ex 3 0 0
100.0% lib/auth_web/views/role_view.ex 10 3 0
[TOTAL] 100.0%
----------------
Just ran:
On
main
branch onlocalhost
and got the following output:I've made most of the recent changes to this repo ... https://github.com/dwyl/auth/commits/main 🧑💻 So going investigate this now. 🔍