Hello,
When I update phoenix from 1.7.21 → 1.8.x, I get an error running mix test:
== Compilation error in file test/tree_test.exs ==
** (BadMapError) expected a map, got:
[]
(phoenix 1.8.2) lib/phoenix/verified_routes.ex:943: Phoenix.VerifiedRoutes.rewrite_path/4
(phoenix 1.8.2) lib/phoenix/verified_routes.ex:915: Phoenix.VerifiedRoutes.build_route/5
(phoenix 1.8.2) expanding macro: Phoenix.VerifiedRoutes.sigil_p/2
test/tree_test.exs:26: Jiggy.Test.TreeTest."test create a tree"/1
(phoenix_live_view 1.1.18) expanding macro: Phoenix.LiveViewTest.live/2
test/tree_test.exs:26: Jiggy.Test.TreeTest."test create a tree"/1
line 26:
{:ok, view, _html} = live(conn, ~p"/season/#{season.uuid}")
The regular mix phx.server shows no error.
If I try IO.Inspect on season, it seems it doesn’t even reach the test.
Any thoughts or suggestions?
This also upgraded lazy_html from 0.1.6 → 0.1.8, but there’s no changelog for that so I can’t confirm anything happened there.
Edit: lazy_html is actually unrelated but I’m not allowed to delete this reply
Where does ‘season’ come from? It seems it is bound to wrong value (an empty list instead of a map)
It’s a module/struct which has a uuid field
in Season.t() uuid: Ecto.UUID.t() | nil
in the schema field :uuid, Ecto.UUID, default: Ecto.UUID.generate()
How are you calling use Phoenix.VerifiedRoutes in your test?
The error happens at compile time. The value of season can only be set as well as known at runtime after compilation is done. So that shouldn’t really matter.
It came to my mind but my ‘skip’ update was not posted 
defmodule Jiggy.Test.TreeTest do
use JiggyWeb.Test.LiveViewCase, async: false
...
I put it in this file:
defmodule JiggyWeb.Test.LiveViewCase do
use ExUnit.CaseTemplate
using do
quote do
use JiggyWeb.Test.ConnCase
import Phoenix.LiveViewTest
import Phoenix.VerifiedRoutes
@router JiggyWeb.Router
end
end
end
I am almost sure you must `use Phoenix.VerifiedRoutes` instead. Please open up an issue, as this would definitely be a common mistake and we should raise a better error message!
Sure, I will 
switching it to:
use Phoenix.VerifiedRoutes
changes the error message to:
== Compilation error in file test/tree_test.exs ==
** (KeyError) key :router not found in:
[]
(elixir 1.19.4) lib/keyword.ex:608: Keyword.fetch!/2
(phoenix 1.8.2) lib/phoenix/verified_routes.ex:245: Phoenix.VerifiedRoutes.__using__/2
test/forest_test.exs:2: (module)
(elixir 1.19.4) lib/kernel/parallel_compiler.ex:648: Kernel.ParallelCompiler.require_file/2
(elixir 1.19.4) lib/kernel/parallel_compiler.ex:531: anonymous fn/5 in Kernel.ParallelCompiler.spawn_workers/8
Yes, you need to pass the router and perhaps other options. Check the docs!
but at least this message is pointing to somewhere!
Here is an example from the 1.8 generator:
use Phoenix.VerifiedRoutes,
endpoint: MyAppWeb.Endpoint,
router: MyAppWeb.Router,
statics: MyAppWeb.static_paths()
The installer generates a macro to do this for you, similar to the other use MyAppWeb macros:
use MyAppWeb, :verified_routes
Thank you everyone!
Starting with josevalim’s answer and continuing with vkryukov’s solved the problem.
It’s nice to be part of the Elixir community 
Documentation is always your friend here.