MCPcopy
hub / github.com/nats-io/nats.go / TestEncBuiltinFailedEncodedPublish

Function TestEncBuiltinFailedEncodedPublish

test/json_test.go:288–313  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

286}
287
288func TestEncBuiltinFailedEncodedPublish(t *testing.T) {
289 s := RunServerOnPort(TEST_PORT)
290 defer s.Shutdown()
291
292 ec := NewJsonEncodedConn(t)
293 defer ec.Close()
294
295 ch := make(chan bool)
296 err := ec.Publish("foo", ch)
297 if err == nil {
298 t.Fatal("Expected an error trying to publish a channel")
299 }
300 err = ec.PublishRequest("foo", "bar", ch)
301 if err == nil {
302 t.Fatal("Expected an error trying to publish a channel")
303 }
304 var cr chan bool
305 err = ec.Request("foo", ch, &cr, 1*time.Second)
306 if err == nil {
307 t.Fatal("Expected an error trying to publish a channel")
308 }
309 err = ec.LastError()
310 if err != nil {
311 t.Fatalf("Expected LastError to be nil: %q ", err)
312 }
313}
314
315func TestEncBuiltinDecodeConditionals(t *testing.T) {
316 je := &builtin.JsonEncoder{}

Callers

nothing calls this directly

Calls 8

NewJsonEncodedConnFunction · 0.85
FatalfMethod · 0.80
RunServerOnPortFunction · 0.70
PublishMethod · 0.65
CloseMethod · 0.45
PublishRequestMethod · 0.45
RequestMethod · 0.45
LastErrorMethod · 0.45

Tested by

no test coverage detected