github.com/status-im/status-go@v1.1.0/account/onboarding_test.go (about)

     1  package account
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/stretchr/testify/assert"
     8  	"github.com/stretchr/testify/require"
     9  )
    10  
    11  func TestOnboarding(t *testing.T) {
    12  	count := 2
    13  	wordsCount := 24
    14  	o, _ := NewOnboarding(count, wordsCount)
    15  	assert.Equal(t, count, len(o.accounts))
    16  
    17  	for id, a := range o.accounts {
    18  		words := strings.Split(a.mnemonic, " ")
    19  
    20  		assert.Equal(t, wordsCount, len(words))
    21  		assert.NotEmpty(t, a.Info.WalletAddress)
    22  		assert.NotEmpty(t, a.Info.WalletPubKey)
    23  		assert.NotEmpty(t, a.Info.ChatAddress)
    24  		assert.NotEmpty(t, a.Info.ChatPubKey)
    25  
    26  		retrieved, err := o.Account(id)
    27  		require.NoError(t, err)
    28  		assert.Equal(t, a, retrieved)
    29  	}
    30  }