From ec8e95d26209bfdc3a9479172b4681c0f96139fd Mon Sep 17 00:00:00 2001 From: upsaurav12 Date: Tue, 13 May 2025 11:55:07 +0530 Subject: [PATCH] imp: improved test coverage from 66.7 to 100% --- provider/zone_id_filter_test.go | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/provider/zone_id_filter_test.go b/provider/zone_id_filter_test.go index 41e313886..65d6e2062 100644 --- a/provider/zone_id_filter_test.go +++ b/provider/zone_id_filter_test.go @@ -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()) + } +}