I have this code in the module
alias Commerce.Cart.{Cart, CartMaster}
@spec call(Cart.t()) :: Cart.t()
def call(cart) do
cart
|> add_pets_adjustments()
|> CartMaster.recalculate_credit()
end
when I run the test I get this error
** (UndefinedFunctionError) function Commerce.Cart.CartMaster.recalculate_credit/1 is undefined (module Commerce.Cart.CartMaster is not available)
I checked the CartMaster module and the name is correct
defmodule Commerce.Cart.CartMaster do
# ...
def recalculate_credit(cart) do
cart
|> remove_existing_credit_adjustment
|> remove_applied_credit()
|> apply_credit()
|> add_credit_adjustment()
end
end
I also changed the function call to
def call(cart) do
cart
|> add_pets_adjustments()
|> Commerce.Cart.CartMaster.recalculate_credit()
end
And got the same error
I checked in the "_build/test/lib/app/ebin" and I found the Elixir.Commerce.Cart.CartMaster.beam file
calling the function to check modules loaded inside the call function
:app
|> :application.get_key(:modules)
|> elem(1)
|> Enum.filter(fn e -> String.contains?(to_string(e), "Commerce.Cart") end)
|> IO.inspect(label: :modules)
the module shows in the list
modules: [Commerce.Cart.Adjustment, Commerce.Cart.Cart, Commerce.Cart.CartMaster, ...]
running the app in development mode and doing manual testing works just fine,
I'm out of ideas of what it can be.