-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwallet_test.go
33 lines (25 loc) · 915 Bytes
/
wallet_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package blockchain_test
import (
"os"
"testing"
"github.com/stretchr/testify/require"
"github.com/goplugin/plugin-testing-framework/lib/blockchain"
"github.com/goplugin/plugin-testing-framework/lib/logging"
)
// Publicly available private key that is used as default in hardhat, geth, etc...
// #nosec G101
var key = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
// Address of the key above
var address = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
func TestMain(m *testing.M) {
logging.Init()
os.Exit(m.Run())
}
func TestWallet(t *testing.T) {
t.Parallel()
wallet, err := blockchain.NewEthereumWallet(key)
require.NoError(t, err)
require.Equal(t, address, wallet.Address(), "Address of key '%s' not as expected", key)
require.Equal(t, key, wallet.PrivateKey(), "Private key not as expected")
require.Equal(t, key, wallet.RawPrivateKey(), "Private key not as expected")
}