defmodule Aprsme.ApplicationTest do
  use ExUnit.Case, async: false

  describe "config_change/3" do
    test "returns :ok" do
      assert :ok = Aprsme.Application.config_change(%{}, %{}, [])
    end

    test "returns :ok with populated change maps" do
      assert :ok =
               Aprsme.Application.config_change(
                 %{secret_key_base: "x"},
                 %{},
                 [:removed_key]
               )
    end
  end

  describe "start/2" do
    test "module is loaded and exports the Application behaviour callbacks" do
      functions = Aprsme.Application.__info__(:functions)
      assert {:start, 2} in functions
      assert {:config_change, 3} in functions
    end
  end

  describe "module compilation" do
    test "Application module is loaded and has the Application behaviour" do
      Code.ensure_loaded!(Aprsme.Application)
      behaviours = Aprsme.Application.module_info(:attributes)[:behaviour] || []
      assert Application in behaviours
    end
  end
end
