MCPcopy
hub / github.com/appleboy/gin-jwt / TestInMemoryRefreshTokenStore_GetExpired

Function TestInMemoryRefreshTokenStore_GetExpired

store/memory_test.go:118–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

116}
117
118func TestInMemoryRefreshTokenStore_GetExpired(t *testing.T) {
119 store := NewInMemoryRefreshTokenStore()
120 user := &User{ID: "123", Username: "testuser"}
121 expiry := time.Now().Add(-time.Hour) // Expired 1 hour ago
122
123 // Set an expired token
124 err := store.Set(context.Background(), "expired_token", user, expiry)
125 if err != nil {
126 t.Fatalf("Set() returned error: %v", err)
127 }
128
129 // Try to get the expired token
130 _, err = store.Get(context.Background(), "expired_token")
131 if err != ErrRefreshTokenNotFound {
132 t.Fatalf("Expected ErrRefreshTokenNotFound for expired token, got: %v", err)
133 }
134
135 // Verify the expired token was cleaned up
136 count, _ := store.Count(context.Background())
137 if count != 0 {
138 t.Fatalf("Expected count to be 0 after expired token cleanup, got %d", count)
139 }
140}
141
142func TestInMemoryRefreshTokenStore_Delete(t *testing.T) {
143 store := NewInMemoryRefreshTokenStore()

Callers

nothing calls this directly

Calls 4

SetMethod · 0.95
GetMethod · 0.95
CountMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…