TestVoidProcessor tests the void processor implementation
(t *testing.T)
| 467 | |
| 468 | // TestVoidProcessor tests the void processor implementation |
| 469 | func 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 |
nothing calls this directly
no test coverage detected