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

Function TestInMemoryRefreshTokenStore_Delete

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

Source from the content-addressed store, hash-verified

140}
141
142func TestInMemoryRefreshTokenStore_Delete(t *testing.T) {
143 store := NewInMemoryRefreshTokenStore()
144 user := &User{ID: "123", Username: "testuser"}
145 expiry := time.Now().Add(time.Hour)
146
147 // Set a token
148 err := store.Set(context.Background(), "token123", user, expiry)
149 if err != nil {
150 t.Fatalf("Set() returned error: %v", err)
151 }
152
153 // Delete the token
154 err = store.Delete(context.Background(), "token123")
155 if err != nil {
156 t.Fatalf("Delete() returned error: %v", err)
157 }
158
159 // Verify the token is gone
160 _, err = store.Get(context.Background(), "token123")
161 if err != ErrRefreshTokenNotFound {
162 t.Fatalf("Expected ErrRefreshTokenNotFound after deletion, got: %v", err)
163 }
164
165 count, _ := store.Count(context.Background())
166 if count != 0 {
167 t.Fatalf("Expected count to be 0 after deletion, got %d", count)
168 }
169}
170
171func TestInMemoryRefreshTokenStore_DeleteNonExistent(t *testing.T) {
172 store := NewInMemoryRefreshTokenStore()

Callers

nothing calls this directly

Calls 5

SetMethod · 0.95
DeleteMethod · 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…