github.com/clubpay/ronykit/kit@v0.14.4-0.20240515065620-d0dace45cbc7/ctx_limited_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("CtxLimited", func() {
    10  	ctx := kit.NewContext(nil)
    11  	conn := newTestConn(100, "", true)
    12  	ctx.SetConn(conn)
    13  
    14  	It("Should be synced with the main context", func() {
    15  		limitCtx := ctx.Limited()
    16  		Expect(limitCtx.Conn().ConnID()).To(Equal(conn.ConnID()))
    17  		Expect(limitCtx.ServiceName()).To(Equal(ctx.ServiceName()))
    18  		limitCtx.In().SetHdr("k1", "v1")
    19  		Expect(ctx.In().GetHdr("k1")).To(Equal("v1"))
    20  	})
    21  })