MCPcopy
hub / github.com/gofiber/fiber / TestStore_Get_SessionAlreadyLoaded

Function TestStore_Get_SessionAlreadyLoaded

middleware/session/store_test.go:127–148  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

125}
126
127func TestStore_Get_SessionAlreadyLoaded(t *testing.T) {
128 // Create a new Fiber app
129 app := fiber.New()
130
131 // Create a new context
132 ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
133 defer app.ReleaseCtx(ctx)
134
135 // Mock middleware and set it in the context
136 middleware := &Middleware{}
137 ctx.Locals(middlewareContextKey, middleware)
138
139 // Create a new store
140 store := &Store{}
141
142 // Call the Get method
143 sess, err := store.Get(ctx)
144
145 // Assert that the error is ErrSessionAlreadyLoadedByMiddleware
146 require.Nil(t, sess)
147 require.Equal(t, ErrSessionAlreadyLoadedByMiddleware, err)
148}
149
150func TestStore_Delete(t *testing.T) {
151 // Create a new store

Callers

nothing calls this directly

Calls 5

GetMethod · 0.95
AcquireCtxMethod · 0.80
ReleaseCtxMethod · 0.80
NewMethod · 0.65
LocalsMethod · 0.65

Tested by

no test coverage detected