Fixes broken test

pull/1034/head
robertoschneiders 6 years ago
parent 6a3b3b3c43
commit b50b80dd1e
  1. 2
      apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex
  2. 16
      apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs

@ -55,7 +55,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionView do
"hash" => "#{transaction.hash}", "hash" => "#{transaction.hash}",
"timeStamp" => "#{DateTime.to_unix(transaction.block.timestamp)}", "timeStamp" => "#{DateTime.to_unix(transaction.block.timestamp)}",
"blockNumber" => "#{transaction.block_number}", "blockNumber" => "#{transaction.block_number}",
"confirmations" => "#{(max_block_number - transaction.block_number)}", "confirmations" => "#{max_block_number - transaction.block_number}",
"success" => if(transaction.status == :ok, do: true, else: false), "success" => if(transaction.status == :ok, do: true, else: false),
"from" => "#{transaction.from_address_hash}", "from" => "#{transaction.from_address_hash}",
"to" => "#{transaction.to_address_hash}", "to" => "#{transaction.to_address_hash}",

@ -374,7 +374,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do
|> with_block(block, status: :ok) |> with_block(block, status: :ok)
address = insert(:address) address = insert(:address)
insert(:log, address: address, transaction: transaction) log = insert(:log, address: address, transaction: transaction)
params = %{ params = %{
"module" => "transaction", "module" => "transaction",
@ -382,7 +382,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do
"txhash" => "#{transaction.hash}" "txhash" => "#{transaction.hash}"
} }
expected_result = %{ expected_result = %{
"hash" => "#{transaction.hash}", "hash" => "#{transaction.hash}",
"timeStamp" => "#{DateTime.to_unix(transaction.block.timestamp)}", "timeStamp" => "#{DateTime.to_unix(transaction.block.timestamp)}",
"blockNumber" => "#{transaction.block_number}", "blockNumber" => "#{transaction.block_number}",
@ -394,11 +394,13 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do
"input" => "#{transaction.input}", "input" => "#{transaction.input}",
"gasLimit" => "#{transaction.gas}", "gasLimit" => "#{transaction.gas}",
"gasUsed" => "#{transaction.gas_used}", "gasUsed" => "#{transaction.gas_used}",
"logs" => [%{ "logs" => [
"address" => "#{address}", %{
"data" => "0x00", "address" => "#{address}",
"topics" => [nil, nil, nil, nil] "data" => "#{log.data}",
}] "topics" => [nil, nil, nil, nil]
}
]
} }
assert response = assert response =

Loading…
Cancel
Save