Skip to content

Commit

Permalink
One more templating test
Browse files Browse the repository at this point in the history
  • Loading branch information
pondzix committed Nov 6, 2024
1 parent 891b511 commit 119bcd9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/target/http_templating_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ func TestHTTP_Templating_WithPrettyPrint(t *testing.T) {
{Data: []byte(`{ "event_data": { "nested": "value1"}, "attribute_data": 1}`)},
{Data: []byte(`{ "event_data": { "nested": "value2"}, "attribute_data": 2}`)},
{Data: []byte(`{ "event_data": { "nested": "value3"}, "attribute_data": 3}`)},
{Data: []byte(`{ "event_data": "text", "attribute_data": 4}`)},
}

templated, goodMessages, invalidMessages := target.renderBatchUsingTemplate(inputMessages)

expectedOutput := `
{
"attributes": [1,2,3],
"events": [{"nested":"value1"},{"nested":"value2"},{"nested":"value3"}]
"attributes": [1,2,3,4],
"events": [{"nested":"value1"},{"nested":"value2"},{"nested":"value3"}, "text"]
}`
assert.JSONEq(expectedOutput, string(templated))
assert.Equal(inputMessages, goodMessages)
Expand Down

0 comments on commit 119bcd9

Please sign in to comment.