CherryPoppins

CherryPoppins

Test --cover not changing despite adding test?

I’m having trouble understanding how test --cover is working. I see a module has 0% coverage, add a test for the function defined in that module and test --cover still says 0% for that module. Also, not sure why it is flagging some functions not defined in the module as needing tests. Here is an example of what Im talking about:

here is a screenshot after running test.coverage:

here are the tests for it:

defmodule Core.Tenants.Settings.CheckoutTest do
  @moduledoc false

  use ExUnit.Case, async: true
  alias Core.Tenants.Settings.Checkout

  @valid_attrs %{asset_key: "some string"}
  @invalid_attrs %{}

  test "changeset with valid attributes" do
    changeset = Checkout.changeset(%Checkout{}, @valid_attrs)
    assert changeset.valid?
  end

  test "changeset with invalid attributes" do
    changeset = Checkout.changeset(%Checkout{}, @invalid_attrs)
    refute changeset.valid?
  end

  test "asset_key is required" do
    changeset = Checkout.changeset(%Checkout{}, Map.delete(@valid_attrs, :asset_key))
    refute changeset.valid?
  end
end

Marked As Solved

Sebb

Sebb

This coverage does not make sense.
Which cover-module are you using? I use GitHub - parroty/excoveralls: Coverage report tool for Elixir with coveralls.io integration. · GitHub - which I can recommend.

Also Liked

CherryPoppins

CherryPoppins

awesome, thanks for all the help!

Where Next?

Popular in Questions Top

mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 126479 1222
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement