Skip to content

Commit

Permalink
improved readablity
Browse files Browse the repository at this point in the history
  • Loading branch information
kofoworola committed Jan 7, 2025
1 parent 5cfac63 commit 9128a1c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions apidef/oas/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

Expand Down

0 comments on commit 9128a1c

Please sign in to comment.