diff --git a/test/archethic/oracle_chain/services/uco_price_test.exs b/test/archethic/oracle_chain/services/uco_price_test.exs index c528786cd..f2f9937d1 100644 --- a/test/archethic/oracle_chain/services/uco_price_test.exs +++ b/test/archethic/oracle_chain/services/uco_price_test.exs @@ -42,6 +42,25 @@ defmodule Archethic.OracleChain.Services.UCOPriceTest do assert {:ok, %{"eur" => _, "usd" => _}} = UCOPrice.fetch() end + test "fetch/0 should retrieve some data and build a map with the oracle name in it and keep the precision to 5" do + MockUCOPriceProvider1 + |> expect(:fetch, fn pairs -> + {:ok, %{"eur" => [0.123456789], "usd" => [0.123454789]}} + end) + + MockUCOPriceProvider2 + |> expect(:fetch, fn pairs -> + {:ok, %{"eur" => [0.123456789], "usd" => [0.123454789]}} + end) + + MockUCOPriceProvider3 + |> expect(:fetch, fn pairs -> + {:ok, %{"eur" => [0.123456789], "usd" => [0.123454789]}} + end) + + assert {:ok, %{"eur" => 0.12346, "usd" => 0.12345}} = UCOPrice.fetch() + end + describe "verify/1" do test "should return true if the prices are the good one" do MockUCOPriceProvider1