defmodule Aprsme.Is.IsSupervisorTest do use ExUnit.Case, async: false alias Aprsme.Is.IsSupervisor describe "init/1" do test "returns a supervisor spec with Aprsme.Is as a child" do # init/1 returns the {:ok, sup_flags, child_specs} tuple wrapped via # Supervisor.init/2 — the safest assertion is that the return type is # a valid supervisor init result. assert {:ok, {_sup_flags, child_specs}} = IsSupervisor.init(:ok) assert is_list(child_specs) assert Enum.any?(child_specs, fn spec -> spec.id == Aprsme.Is end) end end describe "start_link/1" do test "the supervisor module exists and is callable" do # We can't actually start the supervisor because Aprsme.Is.init/1 stops # itself in the test environment via :test_environment_disabled. # Verify the function exists and accepts the expected opts. Code.ensure_loaded(IsSupervisor) assert function_exported?(IsSupervisor, :start_link, 1) assert function_exported?(IsSupervisor, :init, 1) end end end