unit tests: improve fixes for message type (data field, type: map)

This commit is contained in:
Helmut Merz 2025-06-15 09:04:04 +02:00
parent 7d6f99505a
commit 90d379552a
4 changed files with 9 additions and 6 deletions

6
lib/scopes_web/common.ex Normal file
View file

@ -0,0 +1,6 @@
defmodule ScopesWeb.Common do
defimpl Phoenix.HTML.Safe, for: Map do
def to_iodata(_data), do: "{}"
end
end

View file

@ -9,7 +9,6 @@ defmodule Scopes.MixProject do
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
consolidate_protocols: Mix.env() != :test,
deps: deps()
]
end

View file

@ -4,8 +4,6 @@ defmodule ScopesWeb.MessageLiveTest do
import Phoenix.LiveViewTest
import Scopes.CoreFixtures
defimpl Phoenix.HTML.Safe, for: Map, do: (def to_iodata(%{}), do: "{}")
@create_attrs %{domain: "some domain", item: "some item", action: "some action", class: "some class"}
@update_attrs %{domain: "some updated domain", item: "some updated item", action: "some updated action", class: "some updated class"}
@invalid_attrs %{domain: nil, item: nil, action: nil, class: nil}

View file

@ -11,11 +11,11 @@ defmodule Scopes.CoreFixtures do
{:ok, message} =
attrs
|> Enum.into(%{
domain: "some domain",
action: "some action",
class: "some class",
#data: %{},
domain: "some domain",
item: "some item"
item: "some item",
data: %{}
})
|> Scopes.Core.create_message()