forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resolver_test.go
55 lines (51 loc) · 986 Bytes
/
resolver_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
// Copyright (C) 2019-2022, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package dynamicip
import (
"strings"
"testing"
"github.com/stretchr/testify/require"
)
func TestNewResolver(t *testing.T) {
type test struct {
service string
validService bool
}
tests := []test{
{
service: OpenDNSName,
validService: true,
},
{
service: IFConfigName,
validService: true,
},
{
service: IFConfigCoName,
validService: true,
},
{
service: IFConfigMeName,
validService: true,
},
{
service: strings.ToUpper(IFConfigMeName),
validService: true,
},
{
service: "not a valid resolution service name",
validService: false,
},
}
for _, tt := range tests {
t.Run(tt.service, func(t *testing.T) {
require := require.New(t)
_, err := NewResolver(tt.service)
if tt.validService {
require.NoError(err)
} else {
require.Error(err)
}
})
}
}