aprs.me/test/aprsme/postgres_notifier_test.exs
Graham McIntire b86153cd27
Fix all mix credo --strict warnings (188 → 0)
- Replace apply/2 with direct fully-qualified calls in movement_test
- Fix assert_receive timeouts < 1000ms across 8 test files
- Move nested import statements to module-level scope
- Fix tests with no assertions and add missing doctest
- Replace weak type assertions with specific value checks
- Fix conditional assertions and length/1 expensive patterns
- Disable inappropriate Jump.CredoChecks.AvoidSocketAssignsInTest
- Fix tests not calling application code with credo:disable
- Add various credo:disable comments for legitimate patterns
2026-06-12 16:27:20 -05:00

24 lines
863 B
Elixir

defmodule Aprsme.PostgresNotifierTest do
use ExUnit.Case, async: true
alias Aprsme.PostgresNotifier
describe "handle_info/2 notification forwarding" do
test "broadcasts the payload on Aprsme.PubSub for aprs_events channel" do
:ok = Phoenix.PubSub.subscribe(Aprsme.PubSub, "postgres:aprsme_events")
msg = {:notification, :conn_stub, :from_pid, "aprs_events", "payload-content"}
assert {:noreply, state} = PostgresNotifier.handle_info(msg, %{conn: :stub})
assert state.conn == :stub
assert_receive {:postgres_notify, "payload-content"}, 1000
end
test "ignores unrelated messages" do
state = %{conn: :stub}
assert {:noreply, ^state} = PostgresNotifier.handle_info(:random_message, state)
assert {:noreply, ^state} = PostgresNotifier.handle_info({:other_tuple, "data"}, state)
end
end
end