Add test to cover notifications streaming
This commit is contained in:
parent
4cf109d3c4
commit
26f5caebae
|
@ -433,5 +433,30 @@ test "receives private statuses", %{user: reading_user, token: token} do
|
||||||
|
|
||||||
assert json == view_json
|
assert json == view_json
|
||||||
end
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue