imp: improved test coverage from 66.7 to 100%

This commit is contained in:
upsaurav12 2025-05-13 11:55:07 +05:30
parent ad7dbb49ae
commit ec8e95d262

View File

@ -28,6 +28,11 @@ type zoneIDFilterTest struct {
expected bool
}
type zoneIdFilterTestIsConfigured struct {
zoneIDFilter []string
expected bool
}
func TestZoneIDFilterMatch(t *testing.T) {
zone := "/hostedzone/ZTST1"
@ -37,6 +42,11 @@ func TestZoneIDFilterMatch(t *testing.T) {
zone,
true,
},
{
[]string{""},
zone,
true,
},
{
[]string{"/hostedzone/ZTST1"},
zone,
@ -77,3 +87,31 @@ func TestZoneIDFilterMatch(t *testing.T) {
assert.Equal(t, tt.expected, zoneIDFilter.Match(tt.zone))
}
}
func TestZoneIDFilterIsConfigured(t *testing.T) {
for _, tt := range []zoneIdFilterTestIsConfigured{
{
[]string{""},
false,
},
{
[]string{},
false,
},
{
[]string{"/hostedzone/ZTST2"},
true,
},
{
[]string{"/hostedzone/ZTST2", "hostedzone/ZTST2"},
true,
},
{
[]string{"/ZSTS2"},
true,
},
} {
zoneIDFilter := NewZoneIDFilter(tt.zoneIDFilter)
assert.Equal(t, tt.expected, zoneIDFilter.IsConfigured())
}
}