Skip to content

Commit

Permalink
test: improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
favonia committed Sep 5, 2022
1 parent c3f8fbb commit 76d0293
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
22 changes: 22 additions & 0 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,28 @@ func TestNormalize(t *testing.T) {
)
},
},
"template/error/proxied/ill-formed": {
input: &config.Config{ //nolint:exhaustruct
Provider: map[ipnet.Type]provider.Provider{
ipnet.IP6: provider.NewCloudflareTrace(),
},
Domains: map[ipnet.Type][]domain.Domain{
ipnet.IP6: {domain.FQDN("a.b.c")},
},
TTLTemplate: `1`,
ProxiedTemplate: `{{domain 12345}}`,
},
ok: false,
expected: nil,
prepareMockPP: func(m *mocks.MockPP) {
gomock.InOrder(
m.EXPECT().IsEnabledFor(pp.Info).Return(true),
m.EXPECT().Infof(pp.EmojiEnvVars, "Checking settings . . ."),
m.EXPECT().IncIndent().Return(m),
m.EXPECT().Errorf(pp.EmojiUserError, "Could not execute the template %q: %v", "{{domain 12345}}", gomock.Any()), //nolint:lll
)
},
},
} {
tc := tc
t.Run(name, func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion internal/domain/fqdn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ func TestFQDNString(t *testing.T) {
))
}

//nolint:dupl
func TestFQDNDescribe(t *testing.T) {
t.Parallel()
for _, tc := range [...]struct {
Expand Down Expand Up @@ -67,6 +66,7 @@ func TestFQDNDescribe(t *testing.T) {
}
}

//nolint:dupl
func TestFQDNSplitter(t *testing.T) {
t.Parallel()
type r = string
Expand Down
3 changes: 2 additions & 1 deletion internal/domain/wildcard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ func TestWildcardString(t *testing.T) {
))
}

//nolint:dupl
func TestWildcardDescribe(t *testing.T) {
t.Parallel()
for _, tc := range [...]struct {
Expand Down Expand Up @@ -58,6 +57,7 @@ func TestWildcardDescribe(t *testing.T) {
{"xn--mgba3gch31f.de", "*.نامهای.de"},
{"xn--mgba3gch31f060k.de", "*.نامه\u200cای.de"},
// some other test cases
{"", "*"},
{"xn--a.xn--a.xn--a.com", "*.xn--a.xn--a.xn--a.com"},
{"a.com....", "*.a.com...."},
{"a.com", "*.a.com"},
Expand All @@ -70,6 +70,7 @@ func TestWildcardDescribe(t *testing.T) {
}
}

//nolint:dupl
func TestWildcardSplitter(t *testing.T) {
t.Parallel()
type r = string
Expand Down

0 comments on commit 76d0293

Please sign in to comment.