Files
EvoGO/pkg/events/nats/nats_producer_test.go
T
root a4add7cc5e fix: skip NATS connection when URL is empty
(cherry picked from commit a3c05b41717bc652ef7736cc2c2b22c4eaed0f5d)
2026-11-09 12:01:00 -03:00

17 lines
456 B
Go

package nats_producer
import "testing"
func TestNewNatsProducerDoesNotConnectWithoutURL(t *testing.T) {
producer, ok := NewNatsProducer(" ", false, nil, nil).(*natsProducer)
if !ok {
t.Fatal("constructor returned an unexpected producer type")
}
if producer.conn != nil {
t.Fatal("NATS connection must stay nil when NATS_URL is empty")
}
if producer.natsGlobalEnabled {
t.Fatal("NATS global publishing must stay disabled without a URL")
}
}