prysm-pulse/validator/keymanager/derived/mnemonic_test.go
Raul Jordan a9a4bb9163
Move Shared/Testutil into Testing (#9659)
* move testutil

* util pkg

* build

* gaz

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2021-09-23 18:53:46 +00:00

21 lines
541 B
Go

package derived
import (
"testing"
"github.com/prysmaticlabs/prysm/testing/assert"
"github.com/prysmaticlabs/prysm/testing/require"
"github.com/tyler-smith/go-bip39"
)
func TestMnemonic_Generate_CanRecover(t *testing.T) {
generator := &EnglishMnemonicGenerator{}
data := make([]byte, 32)
copy(data, "hello-world")
phrase, err := generator.Generate(data)
require.NoError(t, err)
entropy, err := bip39.EntropyFromMnemonic(phrase)
require.NoError(t, err)
assert.DeepEqual(t, data, entropy, "Expected to recover original data")
}