-
Notifications
You must be signed in to change notification settings - Fork 20
/
address_test.go
40 lines (34 loc) · 1014 Bytes
/
address_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
34
35
36
37
38
39
40
package overflow
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestGetAddress(t *testing.T) {
o, err := OverflowTesting()
require.NoError(t, err)
testCases := map[string]string{
"first": "0x179b6b1cb6755e31",
"FlowToken": "0x0ae53cb6e3f42a79",
"Debug": "0xf8d6e0586b0a20c7",
}
for name, result := range testCases {
t.Run(name, func(t *testing.T) {
assert.EqualValues(t, result, o.Address(name))
})
}
}
func TestAddressNetworks(t *testing.T) {
t.Run("emulator with prefix", func(t *testing.T) {
assert.Equal(t, "emulator", GetNetworkFromAddress("0xf8d6e0586b0a20c7"))
})
t.Run("emulator", func(t *testing.T) {
assert.Equal(t, "emulator", GetNetworkFromAddress("f8d6e0586b0a20c7"))
})
t.Run("testnet", func(t *testing.T) {
assert.Equal(t, "testnet", GetNetworkFromAddress("9a0766d93b6608b7"))
})
t.Run("mainnet", func(t *testing.T) {
assert.Equal(t, "mainnet", GetNetworkFromAddress("f233dcee88fe0abe"))
})
}