status-go/services/wallet/common/helpers_test.go

31 lines
780 B
Go
Raw Normal View History

package common
import (
"encoding/hex"
"math/big"
"testing"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require"
)
func TestPackApprovalInputData(t *testing.T) {
expectedData := "095ea7b3000000000000000000000000aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa0000000000000000000000000000000000000000000000000000000000000064"
addr := common.HexToAddress("0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa")
data, err := PackApprovalInputData(big.NewInt(100), &addr)
require.NoError(t, err)
require.Equal(t, expectedData, hex.EncodeToString(data))
}
func TestGetTokenIdFromSymbol(t *testing.T) {
expectedData := big.NewInt(100)
data, err := GetTokenIdFromSymbol(expectedData.String())
require.NoError(t, err)
require.Equal(t, expectedData, data)
}