TIL how to fix flaky faker tests in Phoenix LiveView
February 15, 2024
1 min read
Elixir
Phoenix
Phoenix LiveView
Faker sometimes generates data with special characters. These can be conflicting in test assertions, because Floki (used by LiveViewTest
) encodes certain characters by default.
To prevent Floki from encoding HTML special chars, you need to add:
# config/test.exs
config :floki, :encode_raw_html, false