(t *testing.T)
| 100 | } |
| 101 | |
| 102 | func TestDelete(t *testing.T) { |
| 103 | config.ConfigStore.Store(newTestRedisConfig(t)) |
| 104 | ctx := context.Background() |
| 105 | mockCache, err := NewCache() |
| 106 | assert.NoError(t, err) |
| 107 | |
| 108 | key := "testKey" |
| 109 | value := "testValue" |
| 110 | err = mockCache.Set(ctx, key, value, 10*time.Minute) |
| 111 | if err != nil { |
| 112 | return |
| 113 | } |
| 114 | |
| 115 | // Test deleting an existing key |
| 116 | err = mockCache.Delete(ctx, key) |
| 117 | assert.NoError(t, err) |
| 118 | |
| 119 | // Verify deletion |
| 120 | var getValue string |
| 121 | err = mockCache.Get(ctx, key, &getValue) |
| 122 | assert.NoError(t, err) |
| 123 | assert.Empty(t, getValue) |
| 124 | |
| 125 | // Test deleting a non-existent key |
| 126 | err = mockCache.Delete(ctx, "nonExistentKey") |
| 127 | assert.NoError(t, err) |
| 128 | } |
nothing calls this directly
no test coverage detected