mirror of
https://github.com/status-im/status-go.git
synced 2025-01-11 23:25:29 +00:00
c1d94e214a
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>
33 lines
768 B
Go
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))
|
|
}
|