MCPcopy
hub / github.com/redis/go-redis / TestVoidProcessor

Function TestVoidProcessor

push/push_test.go:469–532  ·  view source on GitHub ↗

TestVoidProcessor tests the void processor implementation

(t *testing.T)

Source from the content-addressed store, hash-verified

467
468// TestVoidProcessor tests the void processor implementation
469func TestVoidProcessor(t *testing.T) {
470 t.Run("NewVoidProcessor", func(t *testing.T) {
471 processor := NewVoidProcessor()
472 if processor == nil {
473 t.Error("NewVoidProcessor should not return nil")
474 }
475 })
476
477 t.Run("GetHandler", func(t *testing.T) {
478 processor := NewVoidProcessor()
479 handler := processor.GetHandler("TEST")
480 if handler != nil {
481 t.Error("VoidProcessor GetHandler should always return nil")
482 }
483 })
484
485 t.Run("RegisterHandler", func(t *testing.T) {
486 processor := NewVoidProcessor()
487 handler := NewTestHandler("test")
488
489 err := processor.RegisterHandler("TEST", handler, false)
490 if err == nil {
491 t.Error("VoidProcessor RegisterHandler should return error")
492 }
493
494 if !strings.Contains(err.Error(), "register failed") {
495 t.Errorf("Error message should mention registration failure, got: %v", err)
496 }
497
498 if !strings.Contains(err.Error(), "push notifications are disabled") {
499 t.Errorf("Error message should mention disabled notifications, got: %v", err)
500 }
501 })
502
503 t.Run("UnregisterHandler", func(t *testing.T) {
504 processor := NewVoidProcessor()
505
506 err := processor.UnregisterHandler("TEST")
507 if err == nil {
508 t.Error("VoidProcessor UnregisterHandler should return error")
509 }
510
511 if !strings.Contains(err.Error(), "unregister failed") {
512 t.Errorf("Error message should mention unregistration failure, got: %v", err)
513 }
514 })
515
516 t.Run("ProcessPendingNotifications_NilReader", func(t *testing.T) {
517 processor := NewVoidProcessor()
518 ctx := context.Background()
519 handlerCtx := NotificationHandlerContext{
520 Client: nil,
521 ConnPool: nil,
522 PubSub: nil,
523 Conn: nil,
524 IsBlocking: false,
525 }
526

Callers

nothing calls this directly

Calls 9

GetHandlerMethod · 0.95
RegisterHandlerMethod · 0.95
UnregisterHandlerMethod · 0.95
NewVoidProcessorFunction · 0.85
NewTestHandlerFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected