status-go/services/app-general/currency_store_test.go
Mohamed Javid c1d94e214a
chore_: create currency store and get currencies RPC (#5541)
This commit

- moves the base currency list from status-desktop to status-go
- introduces a new RPC GetCurrencies to fetch the list which can be shared across platforms

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-08-29 16:03:24 +05:30

33 lines
768 B
Go

package appgeneral
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestCurrencyList(t *testing.T) {
currencies := GetCurrencies()
require.NotNil(t, currencies)
require.Equal(t, 83, len(currencies))
popularCurrencies := make([]*Currency, 0)
cryptoCurrencies := make([]*Currency, 0)
otherFiatCurrencies := make([]*Currency, 0)
for _, c := range currencies {
if c.IsPopular {
popularCurrencies = append(popularCurrencies, c)
}
if c.IsToken {
cryptoCurrencies = append(cryptoCurrencies, c)
}
if !c.IsToken && !c.IsPopular {
otherFiatCurrencies = append(otherFiatCurrencies, c)
}
}
require.Equal(t, 5, len(popularCurrencies))
require.Equal(t, 4, len(cryptoCurrencies))
require.Equal(t, 74, len(otherFiatCurrencies))
}