OptimumCredo.Check.Warning.TestWithoutAssertion (OptimumCredo v0.5.0)
View SourceBasics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of low and works with any version of Elixir.
Explanation
A test without an assertion cannot fail for the behaviour it names.
Bad:
test "creates" do
Accounts.create_user(attrs)
endGood:
test "creates" do
assert {:ok, _} = Accounts.create_user(attrs)
endCheck-Specific Parameters
Use the following parameters to configure this check:
:assertion_helpers
Helpers (name, "Mod.name" or {Mod, :name}) accepted when the test body is a single call to one.
This parameter defaults to [].
:treat_bang_call_as_assertion
When true, any call to a name! function counts as an assertion.
This parameter defaults to false.
:treat_mock_expectations_as_assertions
When true, Mox-style expect/expect_once calls count (verified on exit).
This parameter defaults to true.
:treat_match_as_assertion
When true, a refutable pattern match ({:error, _} = call()) counts: it raises on mismatch.
This parameter defaults to true.
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.