(t *testing.T)
| 140 | } |
| 141 | |
| 142 | func 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 | |
| 171 | func TestInMemoryRefreshTokenStore_DeleteNonExistent(t *testing.T) { |
| 172 | store := NewInMemoryRefreshTokenStore() |
nothing calls this directly
no test coverage detected
searching dependent graphs…