diff options
| author | lain <lain@soykaf.club> | 2020-11-03 13:56:12 +0100 | 
|---|---|---|
| committer | lain <lain@soykaf.club> | 2020-11-03 13:56:12 +0100 | 
| commit | c37118e6f26f0305d540047e4ccb8d594d2c0e6b (patch) | |
| tree | 5e2e3767cce93218ae162bd564673d830f2d3e1b /test | |
| parent | 91f6c3243032d88a813e4cfed6bf3d0f1ae5924d (diff) | |
| download | pleroma-c37118e6f26f0305d540047e4ccb8d594d2c0e6b.tar.gz pleroma-c37118e6f26f0305d540047e4ccb8d594d2c0e6b.zip | |
Conversations: A few refactors
Diffstat (limited to 'test')
| -rw-r--r-- | test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs | 12 | ||||
| -rw-r--r-- | test/pleroma/web/mastodon_api/views/conversation_view_test.exs | 6 | 
2 files changed, 7 insertions, 11 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 291b6b295..c67e584dd 100644 --- a/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs +++ b/test/pleroma/web/mastodon_api/controllers/conversation_controller_test.exs @@ -65,12 +65,11 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do        assert Participation.unread_count(user_one) == 0      end -    test "special behaviour when conversation have only one user", %{ +    test "includes the user if the user is the only participant", %{        user: user_one, -      user_two: user_two,        conn: conn      } do -      {:ok, direct} = create_direct_message(user_one, []) +      {:ok, _direct} = create_direct_message(user_one, [])        res_conn = get(conn, "/api/v1/conversations") @@ -78,14 +77,11 @@ defmodule Pleroma.Web.MastodonAPI.ConversationControllerTest do        assert [                 %{ -                 "accounts" => res_accounts, -                 "last_status" => res_last_status +                 "accounts" => [account]                 }               ] = response -      account_ids = Enum.map(res_accounts, & &1["id"]) -      assert length(res_accounts) == 1 -      assert user_one.id in account_ids +      assert user_one.id == account["id"]      end      test "observes limit params", %{ diff --git a/test/pleroma/web/mastodon_api/views/conversation_view_test.exs b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs index cd02158f9..20c10ba3d 100644 --- a/test/pleroma/web/mastodon_api/views/conversation_view_test.exs +++ b/test/pleroma/web/mastodon_api/views/conversation_view_test.exs @@ -38,9 +38,9 @@ defmodule Pleroma.Web.MastodonAPI.ConversationViewTest do      assert conversation.last_status.id == activity.id      assert conversation.last_status.account.id == user.id -    account_ids = Enum.map(conversation.accounts, & &1.id) -    assert length(conversation.accounts) == 1 -    assert other_user.id in account_ids +    assert [account] = conversation.accounts +    assert account.id == other_user.id +      assert conversation.last_status.pleroma.direct_conversation_id == participation.id    end  end | 
