Merge pull request #202 from poanetwork/remove-decimal-commas-#165
Remove decimal commaspull/213/head
commit
43a1ab161c
@ -1,3 +1,33 @@ |
||||
defmodule ExplorerWeb.ChainViewTest do |
||||
use ExplorerWeb.ConnCase, async: true |
||||
|
||||
alias Explorer.ExchangeRates.Token |
||||
alias ExplorerWeb.ChainView |
||||
|
||||
describe "format_exchange_rate/1" do |
||||
test "returns a formatted usd value from a `Token`'s usd_value" do |
||||
token = %Token{usd_value: Decimal.new(5.45)} |
||||
|
||||
assert "$5.45 USD" == ChainView.format_exchange_rate(token) |
||||
assert nil == ChainView.format_exchange_rate(%Token{usd_value: nil}) |
||||
end |
||||
end |
||||
|
||||
describe "format_volume_24h/1" do |
||||
test "returns a formatted usd value from a `Token`'s volume_24h_usd" do |
||||
token = %Token{volume_24h_usd: Decimal.new(5.456)} |
||||
|
||||
assert "$5.456 USD" == ChainView.format_volume_24h(token) |
||||
assert nil == ChainView.format_volume_24h(%Token{volume_24h_usd: nil}) |
||||
end |
||||
end |
||||
|
||||
describe "format_market_cap/1" do |
||||
test "returns a formatted usd value from a `Token`'s market_cap_usd" do |
||||
token = %Token{market_cap_usd: Decimal.new(5.4)} |
||||
|
||||
assert "$5.40 USD" == ChainView.format_market_cap(token) |
||||
assert nil == ChainView.format_market_cap(%Token{market_cap_usd: nil}) |
||||
end |
||||
end |
||||
end |
||||
|
Loading…
Reference in new issue