Skip to content

Commit

Permalink
test: uniq integration case check for recipient = sender
Browse files Browse the repository at this point in the history
  • Loading branch information
jyeshe committed Oct 19, 2021
1 parent edb9d1e commit a81513f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/integration/ae_mdw_web/controllers/tx_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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} =
Expand All @@ -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 ",
Expand Down

0 comments on commit a81513f

Please sign in to comment.