go test -run Test_Session_ResolveContext
(t *testing.T)
| 2031 | |
| 2032 | // go test -run Test_Session_ResolveContext |
| 2033 | func Test_Session_ResolveContext(t *testing.T) { |
| 2034 | t.Parallel() |
| 2035 | |
| 2036 | t.Run("resolve context returns background when ctx is nil", func(t *testing.T) { |
| 2037 | t.Parallel() |
| 2038 | sess := &Session{ctx: nil} |
| 2039 | ctx := sess.resolveContext() |
| 2040 | require.NotNil(t, ctx) |
| 2041 | }) |
| 2042 | |
| 2043 | t.Run("resolve context returns fiber context when ctx is not nil", func(t *testing.T) { |
| 2044 | t.Parallel() |
| 2045 | app := fiber.New() |
| 2046 | fctx := app.AcquireCtx(&fasthttp.RequestCtx{}) |
| 2047 | defer app.ReleaseCtx(fctx) |
| 2048 | |
| 2049 | sess := &Session{ctx: fctx} |
| 2050 | ctx := sess.resolveContext() |
| 2051 | require.Equal(t, fctx, ctx) |
| 2052 | }) |
| 2053 | } |
| 2054 | |
| 2055 | // newSessionWithStorage returns a fresh session backed by the given storage and |
| 2056 | // a cleanup function that releases pooled resources. Because the request has no |
nothing calls this directly
no test coverage detected