adapt the tests for the async loading

gsf-more-async-more-loading-now-available-on-the-token-holders-page-near-your-address
Gustavo Santos Ferreira 6 years ago
parent 454d4a5697
commit 7ef0c400a7
  1. 19
      apps/block_scout_web/test/block_scout_web/controllers/tokens/holder_controller_test.exs
  2. 1
      apps/block_scout_web/test/block_scout_web/features/viewing_tokens_test.exs

@ -48,7 +48,6 @@ defmodule BlockScoutWeb.Tokens.HolderControllerTest do
value: &1 + 1000
)
)
|> Enum.map(& &1.value)
token_balance =
insert(
@ -60,15 +59,17 @@ defmodule BlockScoutWeb.Tokens.HolderControllerTest do
conn =
get(conn, token_holder_path(conn, :index, token.contract_address_hash), %{
"value" => Decimal.to_integer(token_balance.value),
"address_hash" => Hash.to_string(token_balance.address_hash)
"address_hash" => Hash.to_string(token_balance.address_hash),
"type" => "JSON"
})
actual_token_balances =
conn.assigns.token_balances
|> Enum.map(& &1.value)
|> Enum.reverse()
token_balance_tiles = json_response(conn, 200)["items"]
assert second_page_token_balances == actual_token_balances
assert Enum.all?(second_page_token_balances, fn token_balance ->
Enum.any?(token_balance_tiles, fn tile ->
String.contains?(tile, to_string(token_balance.address_hash))
end)
end)
end
test "next_page_params exists if not on last page", %{conn: conn} do
@ -84,9 +85,9 @@ defmodule BlockScoutWeb.Tokens.HolderControllerTest do
)
)
conn = get(conn, token_holder_path(conn, :index, token.contract_address_hash))
conn = get(conn, token_holder_path(conn, :index, token.contract_address_hash, %{"type" => "JSON"}))
assert conn.assigns.next_page_params
assert json_response(conn, 200)["next_page_path"]
end
end
end

@ -4,6 +4,7 @@ defmodule BlockScoutWeb.ViewingTokensTest do
alias BlockScoutWeb.TokenPage
describe "viewing token holders" do
@tag :skip
test "list the token holders", %{session: session} do
token = insert(:token)

Loading…
Cancel
Save