package testutil import ( "context" "github.com/noahlann/nnet/internal/codec" "github.com/noahlann/nnet/internal/request" "github.com/noahlann/nnet/internal/response" ctxpkg "github.com/noahlann/nnet/pkg/context" ) // NewTestContext creates a test context with mock connection, request, and response func NewTestContext(parentCtx context.Context, connID string) ctxpkg.Context { if parentCtx == nil { parentCtx = context.Background() } conn := NewMockConnection(connID) req := request.New([]byte("test"), nil) codecRegistry := codec.NewRegistry() resp := response.New(conn, nil, codecRegistry, "json") return ctxpkg.New(parentCtx, conn, req, resp) } // NewTestContextWithData creates a test context with custom request data func NewTestContextWithData(parentCtx context.Context, connID string, data []byte) ctxpkg.Context { if parentCtx == nil { parentCtx = context.Background() } conn := NewMockConnection(connID) req := request.New(data, nil) codecRegistry := codec.NewRegistry() resp := response.New(conn, nil, codecRegistry, "json") return ctxpkg.New(parentCtx, conn, req, resp) }