MCPcopy Create free account
hub / github.com/github/gh-aw / TestFormatVolumeChange

Function TestFormatVolumeChange

pkg/cli/audit_diff_test.go:286–306  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

284}
285
286func TestFormatVolumeChange(t *testing.T) {
287 tests := []struct {
288 name string
289 total1 int
290 total2 int
291 expected string
292 }{
293 {name: "increase 287%", total1: 23, total2: 89, expected: "+287%"},
294 {name: "decrease 50%", total1: 100, total2: 50, expected: "-50%"},
295 {name: "double", total1: 10, total2: 20, expected: "+100%"},
296 {name: "from zero", total1: 0, total2: 10, expected: "+∞"},
297 {name: "no change", total1: 10, total2: 10, expected: "+0%"},
298 }
299
300 for _, tt := range tests {
301 t.Run(tt.name, func(t *testing.T) {
302 result := formatVolumeChange(tt.total1, tt.total2)
303 assert.Equal(t, tt.expected, result, "Volume change format should match")
304 })
305 }
306}
307
308func TestFirewallDiffJSONSerialization(t *testing.T) {
309 diff := computeFirewallDiff(100, 200, &FirewallAnalysis{

Callers

nothing calls this directly

Calls 2

formatVolumeChangeFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected