github.com/status-im/status-go@v1.1.0/services/app-general/currency_store_test.go (about)

     1  package appgeneral
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  )
     8  
     9  func TestCurrencyList(t *testing.T) {
    10  	currencies := GetCurrencies()
    11  	require.NotNil(t, currencies)
    12  	require.Equal(t, 83, len(currencies))
    13  
    14  	popularCurrencies := make([]*Currency, 0)
    15  	cryptoCurrencies := make([]*Currency, 0)
    16  	otherFiatCurrencies := make([]*Currency, 0)
    17  	for _, c := range currencies {
    18  		if c.IsPopular {
    19  			popularCurrencies = append(popularCurrencies, c)
    20  		}
    21  		if c.IsToken {
    22  			cryptoCurrencies = append(cryptoCurrencies, c)
    23  		}
    24  		if !c.IsToken && !c.IsPopular {
    25  			otherFiatCurrencies = append(otherFiatCurrencies, c)
    26  		}
    27  	}
    28  
    29  	require.Equal(t, 5, len(popularCurrencies))
    30  	require.Equal(t, 4, len(cryptoCurrencies))
    31  	require.Equal(t, 74, len(otherFiatCurrencies))
    32  }