From ed93bfbb55dd7592a6ef48a95124c630be8c7080 Mon Sep 17 00:00:00 2001 From: fvictorio Date: Tue, 4 Dec 2018 11:36:49 -0300 Subject: [PATCH 1/2] Fix randomly failing test --- apps/explorer/test/explorer/chain/address/token_test.exs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/explorer/test/explorer/chain/address/token_test.exs b/apps/explorer/test/explorer/chain/address/token_test.exs index d4f307ace2..5fdd3223dc 100644 --- a/apps/explorer/test/explorer/chain/address/token_test.exs +++ b/apps/explorer/test/explorer/chain/address/token_test.exs @@ -197,7 +197,7 @@ defmodule Explorer.Chain.Address.TokenTest do token2 = :token - |> insert(name: "token-c", type: "ERC-721", decimals: 0, symbol: "TC") + |> insert(name: "token-b", type: "ERC-721", decimals: 0, symbol: "TC") |> Repo.preload(:contract_address) insert( From 65e2592a9d7544ba4e0b2b3dae4ab9f15b710c9c Mon Sep 17 00:00:00 2001 From: fvictorio Date: Wed, 5 Dec 2018 09:38:04 -0300 Subject: [PATCH 2/2] Only assert that last token name is null --- apps/explorer/test/explorer/chain/address/token_test.exs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/explorer/test/explorer/chain/address/token_test.exs b/apps/explorer/test/explorer/chain/address/token_test.exs index 5fdd3223dc..3fa903444d 100644 --- a/apps/explorer/test/explorer/chain/address/token_test.exs +++ b/apps/explorer/test/explorer/chain/address/token_test.exs @@ -197,7 +197,7 @@ defmodule Explorer.Chain.Address.TokenTest do token2 = :token - |> insert(name: "token-b", type: "ERC-721", decimals: 0, symbol: "TC") + |> insert(name: "token-c", type: "ERC-721", decimals: 0, symbol: "TC") |> Repo.preload(:contract_address) insert( @@ -233,13 +233,14 @@ defmodule Explorer.Chain.Address.TokenTest do to_address: build(:address) ) - fetched_tokens = + last_fetched_token = address.hash |> Address.Token.list_address_tokens_with_balance() |> Repo.all() |> Enum.map(& &1.contract_address_hash) + |> List.last() - assert fetched_tokens == [token2.contract_address_hash, token3.contract_address_hash, token.contract_address_hash] + assert last_fetched_token == token.contract_address_hash end test "does not return tokens with zero balance" do