Skip to content

Commit

Permalink
chore: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
DStrand1 committed Oct 15, 2024
1 parent 31b2586 commit 6b561e4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions plugins/processors/enum/enum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ func TestDoNotWriteToDestinationWithoutDefaultOrDefinedMapping(t *testing.T) {
require.False(t, present, "value of field '"+field+"' was present")
}

func TestMultipleFields(t *testing.T) {
mapper := EnumMapper{Mappings: []Mapping{{
Fields: []string{"string_value", "duplicate_string_value"},
ValueMappings: map[string]interface{}{"test": "multiple"},
}}}
require.NoError(t, mapper.Init())
fields := calculateProcessedValues(mapper, createTestMetric())

assertFieldValue(t, "multiple", "string_value", fields)
assertFieldValue(t, "multiple", "duplicate_string_value", fields)
}

func TestFieldGlobMatching(t *testing.T) {
mapper := EnumMapper{Mappings: []Mapping{{
Fields: []string{"*"},
Expand Down

0 comments on commit 6b561e4

Please sign in to comment.