|
|
@ -13,19 +13,13 @@ defmodule Indexer.Token.FetcherTest do |
|
|
|
describe "init/3" do |
|
|
|
describe "init/3" do |
|
|
|
test "returns uncataloged tokens", %{json_rpc_named_arguments: json_rpc_named_arguments} do |
|
|
|
test "returns uncataloged tokens", %{json_rpc_named_arguments: json_rpc_named_arguments} do |
|
|
|
insert(:token, cataloged: true) |
|
|
|
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] |
|
|
|
assert Fetcher.init([], &[&1 | &2], json_rpc_named_arguments) == [uncatalog_address] |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
describe "run/3" do |
|
|
|
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 |
|
|
|
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) |
|
|
|
token = insert(:token, name: nil, symbol: nil, total_supply: nil, decimals: nil, cataloged: false) |
|
|
|
contract_address_hash = token.contract_address_hash |
|
|
|
contract_address_hash = token.contract_address_hash |
|
|
|