pull/1691/head
Ayrat Badykov 6 years ago
parent 0d17a69bf9
commit a6a0d4c5a9
No known key found for this signature in database
GPG Key ID: B44668E265E9396F
  1. 2
      apps/indexer/lib/indexer/token/fetcher.ex
  2. 8
      apps/indexer/test/indexer/token/fetcher_test.exs

@ -71,7 +71,7 @@ defmodule Indexer.Token.Fetcher do
|> MetadataRetriever.get_functions_of()
|> Map.put(:cataloged, true)
{:ok, _} = Chain.update_token(token, token_params)
{:ok, _} = Chain.update_token(%{token | updated_at: DateTime.utc_now()}, token_params)
:ok
end
end

@ -13,19 +13,13 @@ defmodule Indexer.Token.FetcherTest do
describe "init/3" do
test "returns uncataloged tokens", %{json_rpc_named_arguments: json_rpc_named_arguments} do
insert(:token, cataloged: true)
%Token{contract_address_hash: uncatalog_address} = insert(:token, cataloged: false)
%Token{contract_address_hash: uncatalog_address} = insert(:token, cataloged: false) |> IO.inspect()
assert Fetcher.init([], &[&1 | &2], json_rpc_named_arguments) == [uncatalog_address]
end
end
describe "run/3" do
test "skips tokens that have already been cataloged", %{json_rpc_named_arguments: json_rpc_named_arguments} do
expect(EthereumJSONRPC.Mox, :json_rpc, 0, fn _, _ -> :ok end)
%Token{contract_address_hash: contract_address_hash} = insert(:token, cataloged: true)
assert Fetcher.run([contract_address_hash], json_rpc_named_arguments) == :ok
end
test "catalogs tokens that haven't been cataloged", %{json_rpc_named_arguments: json_rpc_named_arguments} do
token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false)
contract_address_hash = token.contract_address_hash

Loading…
Cancel
Save