@@ -87,10 +87,10 @@ func TestPushNotificationRegistry(t *testing.T) {
8787
8888func TestPushNotificationProcessor (t * testing.T ) {
8989 // Test the push notification processor
90- processor := redis .NewPushNotificationProcessor (true )
90+ processor := redis .NewPushNotificationProcessor ()
9191
92- if ! processor .IsEnabled () {
93- t .Error ("Processor should be enabled " )
92+ if processor .GetRegistry () == nil {
93+ t .Error ("Processor should have a registry " )
9494 }
9595
9696 // Test registering handlers
@@ -124,10 +124,9 @@ func TestPushNotificationProcessor(t *testing.T) {
124124 t .Error ("Specific handler should have been called" )
125125 }
126126
127- // Test disabling processor
128- processor .SetEnabled (false )
129- if processor .IsEnabled () {
130- t .Error ("Processor should be disabled" )
127+ // Test that processor always has a registry (no enable/disable anymore)
128+ if processor .GetRegistry () == nil {
129+ t .Error ("Processor should always have a registry" )
131130 }
132131}
133132
@@ -146,8 +145,8 @@ func TestClientPushNotificationIntegration(t *testing.T) {
146145 t .Error ("Push notification processor should be initialized" )
147146 }
148147
149- if ! processor .IsEnabled () {
150- t .Error ("Push notification processor should be enabled" )
148+ if processor .GetRegistry () == nil {
149+ t .Error ("Push notification processor should have a registry when enabled" )
151150 }
152151
153152 // Test registering handlers through client
@@ -187,8 +186,9 @@ func TestClientWithoutPushNotifications(t *testing.T) {
187186 if processor == nil {
188187 t .Error ("Push notification processor should never be nil" )
189188 }
190- if processor .IsEnabled () {
191- t .Error ("Push notification processor should be disabled when PushNotifications is false" )
189+ // VoidPushNotificationProcessor should have nil registry
190+ if processor .GetRegistry () != nil {
191+ t .Error ("VoidPushNotificationProcessor should have nil registry" )
192192 }
193193
194194 // Registering handlers should not panic
@@ -215,8 +215,8 @@ func TestPushNotificationEnabledClient(t *testing.T) {
215215 t .Error ("Push notification processor should be initialized when enabled" )
216216 }
217217
218- if ! processor .IsEnabled () {
219- t .Error ("Push notification processor should be enabled" )
218+ if processor .GetRegistry () == nil {
219+ t .Error ("Push notification processor should have a registry when enabled" )
220220 }
221221
222222 // Test registering a handler
@@ -561,10 +561,10 @@ func TestPushNotificationRegistrySpecificHandlerOnly(t *testing.T) {
561561
562562func TestPushNotificationProcessorEdgeCases (t * testing.T ) {
563563 // Test processor with disabled state
564- processor := redis .NewPushNotificationProcessor (false )
564+ processor := redis .NewPushNotificationProcessor ()
565565
566- if processor .IsEnabled () {
567- t .Error ("Processor should be disabled " )
566+ if processor .GetRegistry () == nil {
567+ t .Error ("Processor should have a registry " )
568568 }
569569
570570 // Test that disabled processor doesn't process notifications
@@ -587,15 +587,14 @@ func TestPushNotificationProcessorEdgeCases(t *testing.T) {
587587 t .Error ("Handler should be called when using registry directly" )
588588 }
589589
590- // Test enabling processor
591- processor .SetEnabled (true )
592- if ! processor .IsEnabled () {
593- t .Error ("Processor should be enabled after SetEnabled(true)" )
590+ // Test that processor always has a registry
591+ if processor .GetRegistry () == nil {
592+ t .Error ("Processor should always have a registry" )
594593 }
595594}
596595
597596func TestPushNotificationProcessorConvenienceMethods (t * testing.T ) {
598- processor := redis .NewPushNotificationProcessor (true )
597+ processor := redis .NewPushNotificationProcessor ()
599598
600599 // Test RegisterHandler convenience method
601600 handlerCalled := false
@@ -822,7 +821,7 @@ func TestPushNotificationRegistryConcurrency(t *testing.T) {
822821
823822func TestPushNotificationProcessorConcurrency (t * testing.T ) {
824823 // Test thread safety of the processor
825- processor := redis .NewPushNotificationProcessor (true )
824+ processor := redis .NewPushNotificationProcessor ()
826825
827826 numGoroutines := 5
828827 numOperations := 50
@@ -845,13 +844,7 @@ func TestPushNotificationProcessorConcurrency(t *testing.T) {
845844 notification := []interface {}{command , "data" }
846845 processor .GetRegistry ().HandleNotification (context .Background (), notification )
847846
848- // Toggle processor state occasionally
849- if j % 20 == 0 {
850- processor .SetEnabled (! processor .IsEnabled ())
851- }
852-
853847 // Access processor state
854- processor .IsEnabled ()
855848 processor .GetRegistry ()
856849 }
857850 }(i )
@@ -898,7 +891,7 @@ func TestPushNotificationClientConcurrency(t *testing.T) {
898891 // Access processor
899892 processor := client .GetPushNotificationProcessor ()
900893 if processor != nil {
901- processor .IsEnabled ()
894+ processor .GetRegistry ()
902895 }
903896 }
904897 }(i )
@@ -929,8 +922,11 @@ func TestPushNotificationConnectionHealthCheck(t *testing.T) {
929922
930923 // Verify push notifications are enabled
931924 processor := client .GetPushNotificationProcessor ()
932- if processor == nil || ! processor .IsEnabled () {
933- t .Fatal ("Push notifications should be enabled" )
925+ if processor == nil {
926+ t .Fatal ("Push notification processor should not be nil" )
927+ }
928+ if processor .GetRegistry () == nil {
929+ t .Fatal ("Push notification registry should not be nil when enabled" )
934930 }
935931
936932 // Register a handler for testing
@@ -959,11 +955,6 @@ func TestPushNotificationConnectionHealthCheck(t *testing.T) {
959955 return
960956 }
961957
962- if ! cn .PushNotificationProcessor .IsEnabled () {
963- t .Error ("Push notification processor should be enabled on connection" )
964- return
965- }
966-
967958 t .Log ("✅ Connection has push notification processor correctly set" )
968959 t .Log ("✅ Connection health check integration working correctly" )
969960}
0 commit comments