(t *testing.T)
| 41 | } |
| 42 | |
| 43 | func TestCache_Delete(t *testing.T) { |
| 44 | cache := createTestCache(t) |
| 45 | |
| 46 | t.Run("should delete existing key", func(t *testing.T) { |
| 47 | key := "to-delete" |
| 48 | cache.Set(key, "value", time.Minute) |
| 49 | |
| 50 | _, ok := cache.Get(key) |
| 51 | require.True(t, ok, "Key should exist before deletion") |
| 52 | |
| 53 | cache.Delete(key) |
| 54 | |
| 55 | _, ok = cache.Get(key) |
| 56 | assert.False(t, ok, "Key should not exist after deletion") |
| 57 | }) |
| 58 | |
| 59 | t.Run("should handle delete non-existent key gracefully", func(t *testing.T) { |
| 60 | assert.NotPanics(t, func() { |
| 61 | cache.Delete("never-existed") |
| 62 | }) |
| 63 | }) |
| 64 | } |
| 65 | |
| 66 | func TestCache_Clear(t *testing.T) { |
| 67 | cache := createTestCache(t) |
nothing calls this directly
no test coverage detected