(t *testing.T)
| 263 | } |
| 264 | |
| 265 | func TestInMemoryAuditLog_GetStatus(t *testing.T) { |
| 266 | auditLog := NewInMemoryAuditLog(nil) |
| 267 | defer func() { _ = auditLog.Close() }() |
| 268 | |
| 269 | // 添加一些事件 |
| 270 | _ = auditLog.LogEvent(AuditEvent{Type: AuditTypeUserLogin, UserID: "user1"}) |
| 271 | _ = auditLog.LogEvent(AuditEvent{Type: AuditTypeUserLogout, UserID: "user2"}) |
| 272 | |
| 273 | status := auditLog.GetStatus() |
| 274 | if status == nil { |
| 275 | t.Fatal("expected status, got nil") |
| 276 | } |
| 277 | |
| 278 | if status.TotalEvents != 2 { |
| 279 | t.Errorf("expected TotalEvents 2, got %d", status.TotalEvents) |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | func TestInMemoryAuditLog_Close(t *testing.T) { |
| 284 | auditLog := NewInMemoryAuditLog(nil) |
nothing calls this directly
no test coverage detected