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

Function TestInMemoryRefreshTokenStore_Count

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

Source from the content-addressed store, hash-verified

250}
251
252func TestInMemoryRefreshTokenStore_Count(t *testing.T) {
253 store := NewInMemoryRefreshTokenStore()
254
255 // Initially empty
256 count, err := store.Count(context.Background())
257 if err != nil {
258 t.Fatalf("Count() returned error: %v", err)
259 }
260 if count != 0 {
261 t.Fatalf("Expected initial count to be 0, got %d", count)
262 }
263
264 // Add tokens
265 expiry := time.Now().Add(time.Hour)
266 for i := 0; i < 5; i++ {
267 token := fmt.Sprintf("token%d", i)
268 user := &User{ID: fmt.Sprintf("%d", i)}
269 _ = store.Set(context.Background(), token, user, expiry)
270 }
271
272 count, err = store.Count(context.Background())
273 if err != nil {
274 t.Fatalf("Count() returned error: %v", err)
275 }
276 if count != 5 {
277 t.Fatalf("Expected count to be 5, got %d", count)
278 }
279}
280
281func TestInMemoryRefreshTokenStore_GetAll(t *testing.T) {
282 store := NewInMemoryRefreshTokenStore()

Callers

nothing calls this directly

Calls 3

CountMethod · 0.95
SetMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…