-
Notifications
You must be signed in to change notification settings - Fork 0
/
gethaws_test.go
56 lines (52 loc) · 1.2 KB
/
gethaws_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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package gethaws
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/stretchr/testify/assert"
"testing"
)
func TestGetEvmProviderType(t *testing.T) {
for _, tt := range []struct {
rpcUrl string
expected Provider
}{
{
rpcUrl: "https://mainnet.alchemy.io/api/aksdnosknadoas",
expected: ProviderRegular,
},
{
rpcUrl: "https://ujinaidnfjdsa.ethereum.managedblockchain.us-east-1.amazonaws.com",
expected: ProviderAws,
},
} {
pt := GetEvmProviderType(tt.rpcUrl)
assert.Equal(t, tt.expected, pt)
}
}
func TestGenerateProviderClients(t *testing.T) {
ctx := context.Background()
for _, tt := range []struct {
rpcUrl string
config *aws.Config
expected Provider
}{
{
rpcUrl: "https://mainnet.alchemy.io/api/aksdnosknadoas",
config: nil,
expected: ProviderRegular,
},
{
rpcUrl: "https://ujinaidnfjdsa.ethereum.managedblockchain.us-east-1.amazonaws.com",
config: nil,
expected: ProviderAws,
},
{
rpcUrl: "https://ujinaidnfjdsa.ethereum.managedblockchain.us-east-1.amazonaws.com",
config: aws.NewConfig(),
expected: ProviderAws,
},
} {
_, _, err := CreateClients(ctx, tt.rpcUrl, tt.config)
assert.NoError(t, err)
}
}