diff options
author | tusooa <tusooa@kazv.moe> | 2023-04-01 08:56:53 -0400 |
---|---|---|
committer | tusooa <tusooa@kazv.moe> | 2023-10-15 17:20:25 -0400 |
commit | 26f5caebae1581f1dcdc6d1352840d27009e061c (patch) | |
tree | bdeb9e1f81c812830f500fcebc2979945c470041 | |
parent | 4cf109d3c4093d788e6b2de229a9e4034146a5be (diff) | |
download | pleroma-26f5caebae1581f1dcdc6d1352840d27009e061c.tar.gz pleroma-26f5caebae1581f1dcdc6d1352840d27009e061c.zip |
Add test to cover notifications streaming
-rw-r--r-- | test/pleroma/integration/mastodon_websocket_test.exs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/pleroma/integration/mastodon_websocket_test.exs b/test/pleroma/integration/mastodon_websocket_test.exs index 5ec681ce3..96648264e 100644 --- a/test/pleroma/integration/mastodon_websocket_test.exs +++ b/test/pleroma/integration/mastodon_websocket_test.exs @@ -433,5 +433,30 @@ defmodule Pleroma.Integration.MastodonWebsocketTest do assert json == view_json end + + test "receives notifications", %{user: reading_user, token: token} do + user = insert(:user) + CommonAPI.follow(reading_user, user) + + {:ok, _} = start_socket("?stream=user:notification&access_token=#{token.token}") + + {:ok, %Pleroma.Activity{id: activity_id} = _activity} = + CommonAPI.post(user, %{ + status: "nice echo chamber @#{reading_user.nickname}", + visibility: "private" + }) + + assert_receive {:text, raw_json}, 1_000 + + assert {:ok, + %{ + "event" => "notification", + "payload" => %{ + "status" => %{ + "id" => ^activity_id + } + } + }} = decode_json(raw_json) + end end end |