Fix token transfers tests

pull/6043/head
Qwerty5Uiop 2 years ago
parent 78e13d7415
commit 67561bc25a
  1. 42
      apps/block_scout_web/test/block_scout_web/controllers/tokens/instance/transfer_controller_test.exs

@ -2,43 +2,29 @@ defmodule BlockScoutWeb.Tokens.Instance.TransferControllerTest do
use BlockScoutWeb.ConnCase, async: false
describe "GET token-transfers/2" do
test "works for ERC-721 tokens", %{conn: conn} do
test "fetches the instance", %{conn: conn} do
contract_address = insert(:address)
insert(:token, contract_address: contract_address)
token_id = 10
contract_address_hash = contract_address.hash
%{log_index: log_index} =
insert(:token_transfer,
from_address: contract_address,
token_contract_address: contract_address,
token_id: token_id
)
conn = get(conn, "/token/#{contract_address.hash}/instance/#{token_id}/token-transfers")
token_id = Decimal.new(10)
assert %{assigns: %{token_instance: %{log_index: ^log_index}}} = conn
end
test "works for ERC-1155 tokens", %{conn: conn} do
contract_address = insert(:address)
insert(:token, contract_address: contract_address)
token_id = 10
%{log_index: log_index} =
insert(:token_transfer,
from_address: contract_address,
token_contract_address: contract_address,
token_id: nil,
token_ids: [token_id]
insert(:token_instance,
token_contract_address_hash: contract_address_hash,
token_id: token_id
)
conn = get(conn, "/token/#{contract_address.hash}/instance/#{token_id}/token-transfers")
conn = get(conn, "/token/#{contract_address_hash}/instance/#{token_id}/token-transfers")
assert %{assigns: %{token_instance: %{log_index: ^log_index}}} = conn
assert %{
assigns: %{
token_instance: %{
instance: %{token_contract_address_hash: ^contract_address_hash, token_id: ^token_id}
}
}
} = conn
end
end
end

Loading…
Cancel
Save