github.com/clubpay/ronykit/kit@v0.14.4-0.20240515065620-d0dace45cbc7/envelope_test.go (about)

     1  package kit_test
     2  
     3  import (
     4  	"github.com/clubpay/ronykit/kit"
     5  	. "github.com/onsi/ginkgo/v2"
     6  	. "github.com/onsi/gomega"
     7  )
     8  
     9  var _ = Describe("Envelope", func() {
    10  	tc := newTestConn(1, "", false)
    11  	ctx := kit.NewContext(nil)
    12  	e := kit.NewEnvelope(ctx, tc, true)
    13  	e.
    14  		SetHdr("K1", "V1").
    15  		SetHdr("K2", "V2").
    16  		SetMsg(kit.RawMessage("Some Random Message"))
    17  
    18  	It("should read header and message", func() {
    19  		Expect(e.GetHdr("K1")).To(Equal("V1"))
    20  		Expect(e.GetHdr("K2")).To(Equal("V2"))
    21  		Expect(e.GetMsg()).To(BeEquivalentTo("Some Random Message"))
    22  	})
    23  })