From ef02ae050499bb3192d6ae0b092a5edb655b5b01 Mon Sep 17 00:00:00 2001 From: Luke Imhoff Date: Wed, 19 Dec 2018 13:30:49 -0600 Subject: [PATCH] Fix missed pinning Showed up as unused variables --- .../validator/metadata_importer_test.exs | 22 +++++++++++-------- .../validator/metadata_retriever_test.exs | 2 +- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/explorer/test/explorer/validator/metadata_importer_test.exs b/apps/explorer/test/explorer/validator/metadata_importer_test.exs index 281c45ec2f..c30e719856 100644 --- a/apps/explorer/test/explorer/validator/metadata_importer_test.exs +++ b/apps/explorer/test/explorer/validator/metadata_importer_test.exs @@ -14,17 +14,19 @@ defmodule Explorer.Validator.MetadataImporterTest do test "inserts new address names when there's none for the validators" do address = insert(:address) - [%{address_hash: address.hash, name: "Testinit Unitorius", primary: true, metadata: %{"test" => "toast"}}] + address_hash = address.hash + + [%{address_hash: address_hash, name: "Testinit Unitorius", primary: true, metadata: %{"test" => "toast"}}] |> MetadataImporter.import_metadata() address_names = - from(an in Address.Name, where: an.address_hash == ^address.hash and an.primary == true) + from(an in Address.Name, where: an.address_hash == ^address_hash and an.primary == true) |> Repo.all() - expected_name = %Address.Name{address_hash: address.hash, name: "Testit Unitorus", metadata: %{"test" => "toast"}} - assert length(address_names) == 1 - assert expected_name = hd(address_names) + + assert %Address.Name{address_hash: ^address_hash, name: "Testinit Unitorius", metadata: %{"test" => "toast"}} = + hd(address_names) end test "updates the primary address name if the validator already has one" do @@ -32,17 +34,19 @@ defmodule Explorer.Validator.MetadataImporterTest do insert(:address_name, address: address, primary: true, name: "Nodealus Faileddi") - [%{address_hash: address.hash, name: "Testit Unitorus", primary: true, metadata: %{"test" => "toast"}}] + address_hash = address.hash + + [%{address_hash: address_hash, name: "Testit Unitorus", primary: true, metadata: %{"test" => "toast"}}] |> MetadataImporter.import_metadata() address_names = from(an in Address.Name, where: an.address_hash == ^address.hash and an.primary == true) |> Repo.all() - expected_name = %Address.Name{address_hash: address.hash, name: "Testit Unitorus", metadata: %{"test" => "toast"}} - assert length(address_names) == 1 - assert expected_name = hd(address_names) + + assert %Address.Name{address_hash: ^address_hash, name: "Testit Unitorus", metadata: %{"test" => "toast"}} = + hd(address_names) end end end diff --git a/apps/explorer/test/explorer/validator/metadata_retriever_test.exs b/apps/explorer/test/explorer/validator/metadata_retriever_test.exs index b2656e7137..9ef09e82ab 100644 --- a/apps/explorer/test/explorer/validator/metadata_retriever_test.exs +++ b/apps/explorer/test/explorer/validator/metadata_retriever_test.exs @@ -47,7 +47,7 @@ defmodule Explorer.Validator.MetadataRetrieverTest do expect( EthereumJSONRPC.Mox, :json_rpc, - fn [%{id: id, method: _, params: _}], _options -> + fn [%{id: ^id, method: _, params: _}], _options -> {:ok, [ %{