From b50b80dd1e2853ea4949a096948d32a8c2390689 Mon Sep 17 00:00:00 2001 From: robertoschneiders Date: Wed, 31 Oct 2018 19:39:38 -0300 Subject: [PATCH] Fixes broken test --- .../views/api/rpc/transaction_view.ex | 2 +- .../api/rpc/transaction_controller_test.exs | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex index b12081ec86..2820163235 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/transaction_view.ex @@ -55,7 +55,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionView do "hash" => "#{transaction.hash}", "timeStamp" => "#{DateTime.to_unix(transaction.block.timestamp)}", "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), "from" => "#{transaction.from_address_hash}", "to" => "#{transaction.to_address_hash}", diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs index 026eb43890..7d28864e5f 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/transaction_controller_test.exs @@ -374,7 +374,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do |> with_block(block, status: :ok) address = insert(:address) - insert(:log, address: address, transaction: transaction) + log = insert(:log, address: address, transaction: transaction) params = %{ "module" => "transaction", @@ -382,7 +382,7 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do "txhash" => "#{transaction.hash}" } - expected_result = %{ + expected_result = %{ "hash" => "#{transaction.hash}", "timeStamp" => "#{DateTime.to_unix(transaction.block.timestamp)}", "blockNumber" => "#{transaction.block_number}", @@ -394,11 +394,13 @@ defmodule BlockScoutWeb.API.RPC.TransactionControllerTest do "input" => "#{transaction.input}", "gasLimit" => "#{transaction.gas}", "gasUsed" => "#{transaction.gas_used}", - "logs" => [%{ - "address" => "#{address}", - "data" => "0x00", - "topics" => [nil, nil, nil, nil] - }] + "logs" => [ + %{ + "address" => "#{address}", + "data" => "#{log.data}", + "topics" => [nil, nil, nil, nil] + } + ] } assert response =