Jump.CredoChecks.AvoidSocketAssignsInTest (Jump.CredoChecks v0.4.0)

View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of high and works with any version of Elixir.

Explanation

Tests should assert expected behavior from the user's perspective rather than coupling to internal LiveView state via socket.assigns.

Instead of accessing socket.assigns.foo, use PhoenixTest-style assertions like assert_has, await_has, await_gone, etc.

Use @moduletag :plug_test, @describetag :plug_test, or @tag :plug_test to opt out for tests that legitimately need to test Plug/conn assigns.

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.