github.com/asynkron/protoactor-go@v0.0.0-20240308120642-ef91a6abee75/actor/message_envelope_test.go (about) 1 package actor 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func TestNormalMessageGivesEmptyMessageHeaders(t *testing.T) { 10 t.Parallel() 11 12 props := PropsFromFunc(func(ctx Context) { 13 if _, ok := ctx.Message().(string); ok { 14 l := len(ctx.MessageHeader().Keys()) 15 ctx.Respond(l) 16 } 17 }) 18 a := rootContext.Spawn(props) 19 20 defer func() { 21 _ = rootContext.StopFuture(a).Wait() 22 }() 23 24 f := rootContext.RequestFuture(a, "hello", testTimeout) 25 26 res, _ := assertFutureSuccess(f, t).(int) 27 assert.Equal(t, 0, res) 28 }