Skip to content

Commit

Permalink
added more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tenmoves authored and Neylix committed Jan 18, 2023
1 parent 3a81131 commit b94d254
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/archethic/oracle_chain/services/uco_price_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b94d254

Please sign in to comment.