From 9128a1c9d0ab8f6402c38dabdfb959a766fb9ae6 Mon Sep 17 00:00:00 2001 From: Kofo Okesola Date: Tue, 7 Jan 2025 09:56:15 +0100 Subject: [PATCH] improved readablity --- apidef/oas/middleware_test.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apidef/oas/middleware_test.go b/apidef/oas/middleware_test.go index 44ba0f4f70e..2a175ab1aef 100644 --- a/apidef/oas/middleware_test.go +++ b/apidef/oas/middleware_test.go @@ -181,32 +181,33 @@ func TestTrafficLogs(t *testing.T) { t.Parallel() var emptyTrafficLogs TrafficLogs - var convertedAPI apidef.APIDefinition + var resultTrafficLogs TrafficLogs + convertedAPI.SetDisabledFlags() emptyTrafficLogs.ExtractTo(&convertedAPI) - var resultTrafficLogs TrafficLogs resultTrafficLogs.Fill(convertedAPI) assert.Equal(t, emptyTrafficLogs, resultTrafficLogs) }) t.Run("enabled with tag header", func(t *testing.T) { - t.Parallel() + var convertedAPI apidef.APIDefinition + var resultTrafficLogs TrafficLogs trafficLogs := TrafficLogs{ Enabled: true, TagHeaders: []string{"X-Team-Name"}, } - var convertedAPI apidef.APIDefinition convertedAPI.SetDisabledFlags() trafficLogs.ExtractTo(&convertedAPI) + assert.Equal(t, trafficLogs.TagHeaders, convertedAPI.TagHeaders) assert.False(t, convertedAPI.DoNotTrack) - var resultTrafficLogs TrafficLogs resultTrafficLogs.Fill(convertedAPI) + assert.Equal(t, trafficLogs, resultTrafficLogs) })