INNER CODE UNIT · Go
TestAuditTemplateConditionalColumn
simagix/hatchet · audit_test.go:221
func TestAuditTemplateConditionalColumn(t *testing.T) {
// Test that the template can handle both cases: with and without ended data
// Test case 1: Data with 3 values (should show Closed Connections column)
dataWith3Values := map[string][]NameValues{
"ip": {
{Name: "192.168.1.100", Values: []interface{}{10, 5000, 8}},
{Name: "192.168.1.101", Values: []interface{}{15, 7000, 12}},
},
}
for _, entry := range dataWith3Values["ip"] {
if len(entry.Values) >= 3 {
t.Logf("Entry %s has %d values - Closed Connections column SHOULD be displayed",
entry.Name, len(entry.Values))
} else {
t.Errorf("Expected entry %s to have 3 values, got %d", entry.Name, len(entry.Values))
}