Test_Session_StoreGetDecodeSessionDataError() — fiber Function Reference
Architecture documentation for the Test_Session_StoreGetDecodeSessionDataError() function in session_test.go from the fiber codebase.
Entity Profile
Dependency Diagram
graph TD bff95008_5061_8049_4dfd_47e0466301c9["Test_Session_StoreGetDecodeSessionDataError()"] 397e6e82_749b_4ef2_9365_02be671c59f7["session_test.go"] bff95008_5061_8049_4dfd_47e0466301c9 -->|defined in| 397e6e82_749b_4ef2_9365_02be671c59f7 style bff95008_5061_8049_4dfd_47e0466301c9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
middleware/session/session_test.go lines 1529–1566
func Test_Session_StoreGetDecodeSessionDataError(t *testing.T) {
// Initialize a new store with default config
store := NewStore()
// Create a new Fiber app
app := fiber.New()
// Generate a fake session ID
sessionID := uuid.New().String()
// Store invalid session data to simulate decode error
err := store.Storage.Set(sessionID, []byte("invalid data"), 0)
require.NoError(t, err, "Failed to set invalid session data")
// Create a new request context
c := app.AcquireCtx(&fasthttp.RequestCtx{})
defer app.ReleaseCtx(c)
// Set the session ID in cookies
c.Request().Header.SetCookie("session_id", sessionID)
// Attempt to get the session
_, err = store.Get(c)
require.Error(t, err, "Expected error due to invalid session data, but got nil")
// Check that the error message is as expected
require.Contains(t, err.Error(), "failed to decode session data", "Unexpected error message")
// Check that the error is as expected
require.ErrorContains(t, err, "failed to decode session data", "Unexpected error")
// Attempt to get the session by ID
_, err = store.GetByID(c, sessionID)
require.Error(t, err, "Expected error due to invalid session data, but got nil")
// Check that the error message is as expected
require.ErrorContains(t, err, "failed to decode session data", "Unexpected error")
}
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does Test_Session_StoreGetDecodeSessionDataError() do?
Test_Session_StoreGetDecodeSessionDataError() is a function in the fiber codebase, defined in middleware/session/session_test.go.
Where is Test_Session_StoreGetDecodeSessionDataError() defined?
Test_Session_StoreGetDecodeSessionDataError() is defined in middleware/session/session_test.go at line 1529.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free