diff options
author | Alibek Omarov <a1ba.omarov@gmail.com> | 2020-10-30 13:01:58 +0100 |
---|---|---|
committer | Gitea <gitea@fake.local> | 2020-10-30 13:59:53 +0100 |
commit | 9b93eef71550eabf55b9728b6c8925a4dede222d (patch) | |
tree | 927ada4c4a939e97397b7d7f0b89aaf3f947f3d1 /test | |
parent | 630eb0f939013db721c78e9b33e4e8bdc8232834 (diff) | |
download | pleroma-9b93eef71550eabf55b9728b6c8925a4dede222d.tar.gz pleroma-9b93eef71550eabf55b9728b6c8925a4dede222d.zip |
ConversationView: fix last_status.account being empty, fix current user being included in group conversations
Diffstat (limited to 'test')
-rw-r--r-- | test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs index afc24027b..8d07cff3f 100644 --- a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs @@ -54,16 +54,37 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do ] = response account_ids = Enum.map(res_accounts, & &1["id"]) - assert length(res_accounts) == 3 - assert user_one.id in account_ids + assert length(res_accounts) == 2 + assert user_one.id not in account_ids assert user_two.id in account_ids assert user_three.id in account_ids assert is_binary(res_id) assert unread == false assert res_last_status["id"] == direct.id + assert res_last_status["account"]["id"] == user_one.id assert Participation.unread_count(user_one) == 0 end + test "special behaviour when conversation have only one user", %{ + user: user_one, + user_two: user_two, + conn: conn + } do + {:ok, direct} = create_direct_message(user_one, []) + + res_conn = get(conn, "/api/v1/conversations") + + assert response = json_response_and_validate_schema(res_conn, 200) + assert [ + %{ + "accounts" => res_accounts, + "last_status" => res_last_status + } + ] = response + assert length(res_accounts) == 1 + assert res_accounts[0]["id"] == user_one.id + end + test "observes limit params", %{ user: user_one, user_two: user_two, |