diff --git a/internal/deviceclass/groupproperty/filter_test.go b/internal/deviceclass/groupproperty/filter_test.go index 478a380..7cdb1ea 100644 --- a/internal/deviceclass/groupproperty/filter_test.go +++ b/internal/deviceclass/groupproperty/filter_test.go @@ -339,7 +339,7 @@ func TestValueFilter_ApplyPropertyGroups_nestedArray(t *testing.T) { propertyGroup{ "ifIndex": "1", "ifDescr": "Ethernet #1", - "radio": []propertyGroup{ + "radio": PropertyGroups{ { "level_in": "10", "level_out": "10", @@ -592,6 +592,45 @@ func TestExclusiveValueFilter_ApplyPropertyGroups_nested(t *testing.T) { assert.Equal(t, expected, filteredGroup) } +func TestExclusiveValueFilter_ApplyPropertyGroups_nestedArray(t *testing.T) { + filter := GetExclusiveValueFilter([][]string{{"radio", "level_in"}}) + + groups := PropertyGroups{ + propertyGroup{ + "ifIndex": "1", + "ifDescr": "Ethernet #1", + "radio": PropertyGroups{ + { + "level_in": "10", + "level_out": "10", + }, + { + "level_in": "7", + "level_out": "5", + }, + }, + }, + } + + filteredGroup, err := filter.ApplyPropertyGroups(context.Background(), groups) + assert.NoError(t, err) + + expected := PropertyGroups{ + propertyGroup{ + "radio": PropertyGroups{ + { + "level_in": "10", + }, + { + "level_in": "7", + }, + }, + }, + } + + assert.Equal(t, expected, filteredGroup) +} + func TestExclusiveValueFilter_ApplyPropertyGroups_multipleNested(t *testing.T) { filter := GetExclusiveValueFilter([][]string{{"radio", "level_in"}, {"radio", "level_out"}})