store_test.go — fiber Source File
Architecture documentation for store_test.go, a go file in the fiber codebase. 1 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 9bbf348a_f496_e909_6f62_6ea1938bfec4["store_test.go"] cc7104af_aece_1fe5_3985_791c7f34910c["context"] 9bbf348a_f496_e909_6f62_6ea1938bfec4 --> cc7104af_aece_1fe5_3985_791c7f34910c style 9bbf348a_f496_e909_6f62_6ea1938bfec4 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
package session
import (
"context"
"fmt"
"testing"
"github.com/gofiber/fiber/v3"
"github.com/gofiber/fiber/v3/extractors"
"github.com/stretchr/testify/require"
"github.com/valyala/fasthttp"
)
// go test -run Test_Store_getSessionID
func Test_Store_getSessionID(t *testing.T) {
t.Parallel()
expectedID := "test-session-id"
// fiber instance
app := fiber.New()
t.Run("from cookie", func(t *testing.T) {
t.Parallel()
// session store
store := NewStore()
// fiber context
ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
defer app.ReleaseCtx(ctx)
// set cookie
ctx.Request().Header.SetCookie(store.Extractor.Key, expectedID)
require.Equal(t, expectedID, store.getSessionID(ctx))
})
t.Run("from header", func(t *testing.T) {
t.Parallel()
// session store
store := NewStore(Config{
Extractor: extractors.FromHeader("session_id"),
})
// fiber context
ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
defer app.ReleaseCtx(ctx)
// set header
ctx.Request().Header.Set(store.Extractor.Key, expectedID)
require.Equal(t, expectedID, store.getSessionID(ctx))
})
t.Run("from url query", func(t *testing.T) {
t.Parallel()
// session store
store := NewStore(Config{
Extractor: extractors.FromQuery("session_id"),
})
// fiber context
ctx := app.AcquireCtx(&fasthttp.RequestCtx{})
defer app.ReleaseCtx(ctx)
// ... (168 more lines)
Domain
Subdomains
Functions
Dependencies
- context
Source
Frequently Asked Questions
What does store_test.go do?
store_test.go is a source file in the fiber codebase, written in go. It belongs to the FiberMiddleware domain, Session subdomain.
What functions are defined in store_test.go?
store_test.go defines 6 function(s): TestStore_Delete, TestStore_Get_SessionAlreadyLoaded, Test_Store_DeleteSession, Test_Store_Get, Test_Store_GetByID, Test_Store_getSessionID.
What does store_test.go depend on?
store_test.go imports 1 module(s): context.
Where is store_test.go in the architecture?
store_test.go is located at middleware/session/store_test.go (domain: FiberMiddleware, subdomain: Session, directory: middleware/session).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free