Add test to validate profile pagination works with keyset
authorMark Felder <feld@feld.me>
Mon, 4 Jan 2021 17:04:58 +0000 (11:04 -0600)
committerMark Felder <feld@feld.me>
Mon, 4 Jan 2021 17:04:58 +0000 (11:04 -0600)
test/pleroma/web/mastodon_api/controllers/account_controller_test.exs

index f6285853a16d7a5db189fdcd48eac676f53cbc38..ba2f196f2954854c295c87cc4faa980d51cc2b39 100644 (file)
@@ -469,6 +469,19 @@ defmodule Pleroma.Web.MastodonAPI.AccountControllerTest do
                }
              ] = result
     end
+
+    test "paginates a user's statuses", %{user: user, conn: conn} do
+      {:ok, post1} = CommonAPI.post(user, %{status: "first post"})
+      {:ok, _} = CommonAPI.post(user, %{status: "second post"})
+
+      response1 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1")
+      assert json_response(response1, 200) |> length() == 1
+
+      response2 = get(conn, "/api/v1/accounts/#{user.id}/statuses?limit=1&min_id=#{post1.id}")
+      assert json_response(response2, 200) |> length() == 1
+
+      refute response1 == response2
+    end
   end
 
   defp local_and_remote_activities(%{local: local, remote: remote}) do