Fix tests and formatting

pull/333/head
jimmay5469 7 years ago
parent e6a3f50675
commit c98d1f72c9
  1. 6
      apps/explorer_web/assets/js/pages/address.js
  2. 1
      apps/explorer_web/lib/explorer_web/chain.ex
  3. 3
      apps/explorer_web/test/explorer_web/controllers/address_internal_transaction_controller_test.exs
  4. 2
      apps/explorer_web/test/explorer_web/controllers/address_transaction_controller_test.exs
  5. 2
      apps/explorer_web/test/explorer_web/controllers/block_controller_test.exs
  6. 2
      apps/explorer_web/test/explorer_web/controllers/block_transaction_controller_test.exs
  7. 2
      apps/explorer_web/test/explorer_web/controllers/pending_transaction_controller_test.exs
  8. 2
      apps/explorer_web/test/explorer_web/controllers/transaction_controller_test.exs
  9. 3
      apps/explorer_web/test/explorer_web/controllers/transaction_internal_transaction_controller_test.exs
  10. 2
      apps/explorer_web/test/explorer_web/controllers/transaction_log_controller_test.exs

@ -43,13 +43,13 @@ router.when('/addresses/:addressHash').then(({ addressHash, blockNumber, filter
msgs = humps.camelizeKeys(msgs) msgs = humps.camelizeKeys(msgs)
if (filter === 'to') { if (filter === 'to') {
msgs = msgs.filter(({toAddressHash})=>toAddressHash===addressHash) msgs = msgs.filter(({toAddressHash}) => toAddressHash === addressHash)
} }
if (filter === 'from') { if (filter === 'from') {
msgs = msgs.filter(({fromAddressHash})=>fromAddressHash===addressHash) msgs = msgs.filter(({fromAddressHash}) => fromAddressHash === addressHash)
} }
const transactionsHtml = msgs.map(({transactionHtml})=>transactionHtml).join('') const transactionsHtml = msgs.map(({transactionHtml}) => transactionHtml).join('')
$transactionsList.prepend(transactionsHtml) $transactionsList.prepend(transactionsHtml)
})) }))
} }

@ -37,6 +37,7 @@ defmodule ExplorerWeb.Chain do
end end
def next_page_params([], _list, _params), do: nil def next_page_params([], _list, _params), do: nil
def next_page_params(_, list, params) do def next_page_params(_, list, params) do
Map.merge(params, paging_params(List.last(list))) Map.merge(params, paging_params(List.last(list)))
end end

@ -154,7 +154,8 @@ defmodule ExplorerWeb.AddressInternalTransactionControllerTest do
conn = get(conn, address_internal_transaction_path(ExplorerWeb.Endpoint, :index, :en, address.hash)) conn = get(conn, address_internal_transaction_path(ExplorerWeb.Endpoint, :index, :en, address.hash))
assert %{block_number: ^number, index: 11, transaction_index: ^transaction_index} = conn.assigns.next_page_params assert %{"block_number" => ^number, "index" => 11, "transaction_index" => ^transaction_index} =
conn.assigns.next_page_params
end end
test "next_page_params are empty if on last page", %{conn: conn} do test "next_page_params are empty if on last page", %{conn: conn} do

@ -105,7 +105,7 @@ defmodule ExplorerWeb.AddressTransactionControllerTest do
conn = get(conn, address_transaction_path(ExplorerWeb.Endpoint, :index, :en, address.hash)) conn = get(conn, address_transaction_path(ExplorerWeb.Endpoint, :index, :en, address.hash))
assert %{block_number: ^number, index: 10} = conn.assigns.next_page_params assert %{"block_number" => ^number, "index" => 10} = conn.assigns.next_page_params
end end
test "next_page_params are empty if on last page", %{conn: conn} do test "next_page_params are empty if on last page", %{conn: conn} do

@ -66,7 +66,7 @@ defmodule ExplorerWeb.BlockControllerTest do
conn = get(conn, block_path(conn, :index, @locale)) conn = get(conn, block_path(conn, :index, @locale))
assert %{block_number: ^number} = conn.assigns.next_page_params assert %{"block_number" => ^number} = conn.assigns.next_page_params
end end
test "next_page_params are empty if on last page", %{conn: conn} do test "next_page_params are empty if on last page", %{conn: conn} do

@ -58,7 +58,7 @@ defmodule ExplorerWeb.BlockTransactionControllerTest do
conn = get(conn, block_transaction_path(ExplorerWeb.Endpoint, :index, :en, block)) conn = get(conn, block_transaction_path(ExplorerWeb.Endpoint, :index, :en, block))
assert %{block_number: ^number, index: 10} = conn.assigns.next_page_params assert %{"block_number" => ^number, "index" => 10} = conn.assigns.next_page_params
end end
test "next_page_params are empty if on last page", %{conn: conn} do test "next_page_params are empty if on last page", %{conn: conn} do

@ -87,7 +87,7 @@ defmodule ExplorerWeb.PendingTransactionControllerTest do
conn = get(conn, pending_transaction_path(ExplorerWeb.Endpoint, :index, :en)) conn = get(conn, pending_transaction_path(ExplorerWeb.Endpoint, :index, :en))
assert %{inserted_at: ^converted_date, hash: ^hash} = conn.assigns.next_page_params assert %{"inserted_at" => ^converted_date, "hash" => ^hash} = conn.assigns.next_page_params
end end
test "next_page_params are empty if on last page", %{conn: conn} do test "next_page_params are empty if on last page", %{conn: conn} do

@ -75,7 +75,7 @@ defmodule ExplorerWeb.TransactionControllerTest do
conn = get(conn, "/en/transactions") conn = get(conn, "/en/transactions")
assert %{block_number: ^number, index: 10} = conn.assigns.next_page_params assert %{"block_number" => ^number, "index" => 10} = conn.assigns.next_page_params
end end
test "next_page_params are empty if on last page", %{conn: conn} do test "next_page_params are empty if on last page", %{conn: conn} do

@ -128,7 +128,8 @@ defmodule ExplorerWeb.TransactionInternalTransactionControllerTest do
conn = get(conn, transaction_internal_transaction_path(ExplorerWeb.Endpoint, :index, :en, transaction.hash)) conn = get(conn, transaction_internal_transaction_path(ExplorerWeb.Endpoint, :index, :en, transaction.hash))
assert %{block_number: ^number, index: 11, transaction_index: ^transaction_index} = conn.assigns.next_page_params assert %{"block_number" => ^number, "index" => 11, "transaction_index" => ^transaction_index} =
conn.assigns.next_page_params
end end
test "next_page_params are empty if on last page", %{conn: conn} do test "next_page_params are empty if on last page", %{conn: conn} do

@ -97,7 +97,7 @@ defmodule ExplorerWeb.TransactionLogControllerTest do
conn = get(conn, transaction_log_path(conn, :index, :en, transaction)) conn = get(conn, transaction_log_path(conn, :index, :en, transaction))
assert %{index: 50} = conn.assigns.next_page_params assert %{"index" => 50} = conn.assigns.next_page_params
end end
test "next_page_params are empty if on last page", %{conn: conn} do test "next_page_params are empty if on last page", %{conn: conn} do

Loading…
Cancel
Save