dwyl / phoenix-ecto-append-only-log-example

📝 A step-by-step example/tutorial showing how to build a Phoenix (Elixir) App where all data is immutable (append only). Precursor to Blockchain, IPFS or Solid!
GNU General Public License v2.0
78 stars 7 forks source link

Coverage ... #10

Open nelsonic opened 5 years ago

nelsonic commented 5 years ago

@dwyl we have a "Gold Standard" for examples/tutorials which must be followed without exception. Tutorials aimed at beginners should always have "complete tests" to eliminate any "excuse" people may have for not writing tests in their projects.

An example is incomplete without having 100% test coverage because it either means that there is superfluous code (which can be removed) OR there is untested code; functionality that is "magic". Both are "below expectations".

At present this example has 56% coverage: https://codecov.io/github/dwyl/phoenix-ecto-append-only-log-example?branch=master

image

Todo

nelsonic commented 5 years ago

P.S: I never ask anyone to do something I'm not prepared to do myself: https://codecov.io/github/dwyl/phoenix-chat-example?branch=master image

nelsonic commented 5 years ago

on localhost, the result of running the command MIX_ENV=test mix cover is: image

Clearly we have some work to do to write a few more test ... 👷

Danwhy commented 5 years ago

We shouldn't need to write any more tests, the only lines that aren't covered are autogenerated Phoenix code

nelsonic commented 5 years ago

@Danwhy yeah, I'm mostly seeing that ... however excoveralls thinks the Macros aren't being used: image

Danwhy commented 5 years ago

Yeah, that's unfortunately a known issue: https://github.com/parroty/excoveralls/issues/59

nelsonic commented 5 years ago

@Danwhy yeah, sucks that Macros don't get "instrumented" for coverage. Does it mean we need to switch to using "normal" Modules/Functions? see: #8

Danwhy commented 5 years ago

It is something to consider. I'll write up some of the pros and cons of each approach when answering #8