From a81513f286263e7ff7c345503e2baead3a39bd6c Mon Sep 17 00:00:00 2001 From: Rogerio Pontual Date: Tue, 19 Oct 2021 16:01:11 +0100 Subject: [PATCH] test: uniq integration case check for recipient = sender --- .../ae_mdw_web/controllers/tx_controller_test.exs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/integration/ae_mdw_web/controllers/tx_controller_test.exs b/test/integration/ae_mdw_web/controllers/tx_controller_test.exs index 58c7f016d..e06d51a90 100644 --- a/test/integration/ae_mdw_web/controllers/tx_controller_test.exs +++ b/test/integration/ae_mdw_web/controllers/tx_controller_test.exs @@ -815,7 +815,8 @@ defmodule Integration.AeMdwWeb.TxControllerTest do test "get transactions when sender_id = recipient_id", %{conn: conn} do id = "ak_gvxNbZf5CuxYVfcUFoKAP4geZatWaC2Yy4jpx5vZoCKank4Gc" - hash_sender_equals_to_recipient = "th_3rw5nk53rEQzZr8xrQ6sqt2Y9Cv4U8piqiHK1KVkXCaVFMTCq" + hash = "th_3rw5nk53rEQzZr8xrQ6sqt2Y9Cv4U8piqiHK1KVkXCaVFMTCq" + field = "recipient_id" %{"data" => txs1} = @@ -826,8 +827,11 @@ defmodule Integration.AeMdwWeb.TxControllerTest do %{"data" => txs2} = conn |> get("txs/gen/421792-0?spend.#{field}=#{id}") |> json_response(200) - assert Enum.find(txs1, fn %{"hash" => hash} -> hash == hash_sender_equals_to_recipient end) - assert Enum.find(txs2, fn %{"hash" => hash} -> hash == hash_sender_equals_to_recipient end) + assert [%{"tx" => %{"sender_id" => ^id, "recipient_id" => ^id}}] = + Enum.filter(txs1, fn tx -> tx["hash"] == hash end) + + assert [%{"tx" => %{"sender_id" => ^id, "recipient_id" => ^id}}] = + Enum.filter(txs2, fn tx -> tx["hash"] == hash end) end test "get transactions when direction=forward, tx_type=oracle_query and field=sender_id ",