commit: eb33a03d0ad8571e3f0f3e0c5e9af39158c72a09
parent 3e7d2e29b369535a9a942a4090cde9a21892f8c1
Author: tusooa <tusooa@kazv.moe>
Date: Tue, 18 Jul 2023 18:13:49 -0400
Explain the encode-decode roundtrip
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/test/pleroma/integration/mastodon_websocket_test.exs b/test/pleroma/integration/mastodon_websocket_test.exs
@@ -38,6 +38,13 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
end
end
+ # Turns atom keys to strings
+ defp atom_key_to_string(json) do
+ json
+ |> Jason.encode!()
+ |> Jason.decode!()
+ end
+
test "refuses invalid requests" do
capture_log(fn ->
assert {:error, %WebSockex.RequestError{code: 404}} = start_socket("?stream=ncjdk")
@@ -80,8 +87,7 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do
view_json =
Pleroma.Web.MastodonAPI.StatusView.render("show.json", activity: activity, for: nil)
- |> Jason.encode!()
- |> Jason.decode!()
+ |> atom_key_to_string()
assert json == view_json
end