diff --git a/apps/explorer_web/test/explorer_web/controllers/address_internal_transaction_controller_test.exs b/apps/explorer_web/test/explorer_web/controllers/address_internal_transaction_controller_test.exs index 88d8ad1e97..5f5a4b88f3 100644 --- a/apps/explorer_web/test/explorer_web/controllers/address_internal_transaction_controller_test.exs +++ b/apps/explorer_web/test/explorer_web/controllers/address_internal_transaction_controller_test.exs @@ -3,7 +3,7 @@ defmodule ExplorerWeb.AddressInternalTransactionControllerTest do import ExplorerWeb.Router.Helpers, only: [address_internal_transaction_path: 4] - alias Explorer.Chain.InternalTransaction + alias Explorer.Chain.{Block, InternalTransaction, Transaction} alias Explorer.ExchangeRates.Token describe "GET index/3" do @@ -134,11 +134,13 @@ defmodule ExplorerWeb.AddressInternalTransactionControllerTest do test "next_page_params exist if not on last page", %{conn: conn} do address = insert(:address) + block = %Block{number: number} = insert(:block) transaction = + %Transaction{index: transaction_index} = :transaction |> insert() - |> with_block() + |> with_block(block) 1..60 |> Enum.map(fn index -> @@ -152,7 +154,7 @@ defmodule ExplorerWeb.AddressInternalTransactionControllerTest do conn = get(conn, address_internal_transaction_path(ExplorerWeb.Endpoint, :index, :en, address.hash)) - assert conn.assigns.next_page_params + assert %{block_number: ^number, index: 11, transaction_index: ^transaction_index} = conn.assigns.next_page_params end test "next_page_params are empty if on last page", %{conn: conn} do diff --git a/apps/explorer_web/test/explorer_web/controllers/address_transaction_controller_test.exs b/apps/explorer_web/test/explorer_web/controllers/address_transaction_controller_test.exs index 27a2e1db13..46a222f486 100644 --- a/apps/explorer_web/test/explorer_web/controllers/address_transaction_controller_test.exs +++ b/apps/explorer_web/test/explorer_web/controllers/address_transaction_controller_test.exs @@ -3,7 +3,7 @@ defmodule ExplorerWeb.AddressTransactionControllerTest do import ExplorerWeb.Router.Helpers, only: [address_transaction_path: 4] - alias Explorer.Chain.Transaction + alias Explorer.Chain.{Block, Transaction} alias Explorer.ExchangeRates.Token describe "GET index/2" do @@ -97,14 +97,15 @@ defmodule ExplorerWeb.AddressTransactionControllerTest do test "next_page_params exist if not on last page", %{conn: conn} do address = insert(:address) + block = %Block{number: number} = insert(:block) 60 |> insert_list(:transaction, from_address: address) - |> with_block() + |> with_block(block) conn = get(conn, address_transaction_path(ExplorerWeb.Endpoint, :index, :en, address.hash)) - assert conn.assigns.next_page_params + assert %{block_number: ^number, index: 10} = conn.assigns.next_page_params end test "next_page_params are empty if on last page", %{conn: conn} do diff --git a/apps/explorer_web/test/explorer_web/controllers/block_controller_test.exs b/apps/explorer_web/test/explorer_web/controllers/block_controller_test.exs index 849e11a685..8f0412239a 100644 --- a/apps/explorer_web/test/explorer_web/controllers/block_controller_test.exs +++ b/apps/explorer_web/test/explorer_web/controllers/block_controller_test.exs @@ -1,5 +1,6 @@ defmodule ExplorerWeb.BlockControllerTest do use ExplorerWeb.ConnCase + alias Explorer.Chain.Block @locale "en" @@ -58,11 +59,14 @@ defmodule ExplorerWeb.BlockControllerTest do end test "next_page_params exist if not on last page", %{conn: conn} do - insert_list(60, :block) + %Block{number: number} = + 60 + |> insert_list(:block) + |> Enum.fetch!(10) conn = get(conn, block_path(conn, :index, @locale)) - assert conn.assigns.next_page_params + assert %{block_number: ^number} = conn.assigns.next_page_params end test "next_page_params are empty if on last page", %{conn: conn} do diff --git a/apps/explorer_web/test/explorer_web/controllers/block_transaction_controller_test.exs b/apps/explorer_web/test/explorer_web/controllers/block_transaction_controller_test.exs index 04c7034abd..c0bcbd1b8c 100644 --- a/apps/explorer_web/test/explorer_web/controllers/block_transaction_controller_test.exs +++ b/apps/explorer_web/test/explorer_web/controllers/block_transaction_controller_test.exs @@ -1,6 +1,7 @@ defmodule ExplorerWeb.BlockTransactionControllerTest do use ExplorerWeb.ConnCase + alias Explorer.Chain.Block import ExplorerWeb.Router.Helpers, only: [block_transaction_path: 4] describe "GET index/2" do @@ -49,7 +50,7 @@ defmodule ExplorerWeb.BlockTransactionControllerTest do end test "next_page_params exist if not on last page", %{conn: conn} do - block = insert(:block) + block = %Block{number: number} = insert(:block) 60 |> insert_list(:transaction) @@ -57,7 +58,7 @@ defmodule ExplorerWeb.BlockTransactionControllerTest do conn = get(conn, block_transaction_path(ExplorerWeb.Endpoint, :index, :en, block)) - assert conn.assigns.next_page_params + assert %{block_number: ^number, index: 10} = conn.assigns.next_page_params end test "next_page_params are empty if on last page", %{conn: conn} do diff --git a/apps/explorer_web/test/explorer_web/controllers/pending_transaction_controller_test.exs b/apps/explorer_web/test/explorer_web/controllers/pending_transaction_controller_test.exs index d5bc7bd503..097b2d33f7 100644 --- a/apps/explorer_web/test/explorer_web/controllers/pending_transaction_controller_test.exs +++ b/apps/explorer_web/test/explorer_web/controllers/pending_transaction_controller_test.exs @@ -78,12 +78,16 @@ defmodule ExplorerWeb.PendingTransactionControllerTest do end test "next_page_params exist if not on last page", %{conn: conn} do - 60 - |> insert_list(:transaction) + %Transaction{inserted_at: inserted_at, hash: hash} = + 60 + |> insert_list(:transaction) + |> Enum.fetch!(10) + + converted_date = DateTime.to_iso8601(inserted_at) conn = get(conn, pending_transaction_path(ExplorerWeb.Endpoint, :index, :en)) - assert conn.assigns.next_page_params + assert %{inserted_at: ^converted_date, hash: ^hash} = conn.assigns.next_page_params end test "next_page_params are empty if on last page", %{conn: conn} do diff --git a/apps/explorer_web/test/explorer_web/controllers/transaction_controller_test.exs b/apps/explorer_web/test/explorer_web/controllers/transaction_controller_test.exs index 34ccb576f5..b978114a1a 100644 --- a/apps/explorer_web/test/explorer_web/controllers/transaction_controller_test.exs +++ b/apps/explorer_web/test/explorer_web/controllers/transaction_controller_test.exs @@ -1,6 +1,6 @@ defmodule ExplorerWeb.TransactionControllerTest do use ExplorerWeb.ConnCase - alias Explorer.Chain.Transaction + alias Explorer.Chain.{Block, Transaction} import ExplorerWeb.Router.Helpers, only: [transaction_path: 4, transaction_internal_transaction_path: 4] @@ -67,14 +67,15 @@ defmodule ExplorerWeb.TransactionControllerTest do test "next_page_params exist if not on last page", %{conn: conn} do address = insert(:address) + block = %Block{number: number} = insert(:block) 60 |> insert_list(:transaction, from_address: address) - |> with_block() + |> with_block(block) conn = get(conn, "/en/transactions") - assert conn.assigns.next_page_params + assert %{block_number: ^number, index: 10} = conn.assigns.next_page_params end test "next_page_params are empty if on last page", %{conn: conn} do diff --git a/apps/explorer_web/test/explorer_web/controllers/transaction_internal_transaction_controller_test.exs b/apps/explorer_web/test/explorer_web/controllers/transaction_internal_transaction_controller_test.exs index d1e969eeef..4d80858d41 100644 --- a/apps/explorer_web/test/explorer_web/controllers/transaction_internal_transaction_controller_test.exs +++ b/apps/explorer_web/test/explorer_web/controllers/transaction_internal_transaction_controller_test.exs @@ -3,7 +3,7 @@ defmodule ExplorerWeb.TransactionInternalTransactionControllerTest do import ExplorerWeb.Router.Helpers, only: [transaction_internal_transaction_path: 4] - alias Explorer.Chain.InternalTransaction + alias Explorer.Chain.{Block, InternalTransaction, Transaction} alias Explorer.ExchangeRates.Token describe "GET index/3" do @@ -109,10 +109,13 @@ defmodule ExplorerWeb.TransactionInternalTransactionControllerTest do end test "next_page_params exist if not on last page", %{conn: conn} do + block = %Block{number: number} = insert(:block) + transaction = + %Transaction{index: transaction_index} = :transaction |> insert() - |> with_block() + |> with_block(block) 1..60 |> Enum.map(fn index -> @@ -125,7 +128,7 @@ defmodule ExplorerWeb.TransactionInternalTransactionControllerTest do conn = get(conn, transaction_internal_transaction_path(ExplorerWeb.Endpoint, :index, :en, transaction.hash)) - assert conn.assigns.next_page_params + assert %{block_number: ^number, index: 11, transaction_index: ^transaction_index} = conn.assigns.next_page_params end test "next_page_params are empty if on last page", %{conn: conn} do diff --git a/apps/explorer_web/test/explorer_web/controllers/transaction_log_controller_test.exs b/apps/explorer_web/test/explorer_web/controllers/transaction_log_controller_test.exs index 3b7d6c1f72..4fed47fd72 100644 --- a/apps/explorer_web/test/explorer_web/controllers/transaction_log_controller_test.exs +++ b/apps/explorer_web/test/explorer_web/controllers/transaction_log_controller_test.exs @@ -81,7 +81,7 @@ defmodule ExplorerWeb.TransactionLogControllerTest do conn = get(conn, transaction_log_path(conn, :index, :en, transaction)) - assert conn.assigns.next_page_params + assert %{index: 50} = conn.assigns.next_page_params end test "next_page_params are empty if on last page", %{conn: conn} do