MCPcopy Create free account
hub / github.com/MertJSX/folderhost / TestCache_Delete

Function TestCache_Delete

test/cache_test.go:43–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41}
42
43func 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
66func TestCache_Clear(t *testing.T) {
67 cache := createTestCache(t)

Callers

nothing calls this directly

Calls 4

createTestCacheFunction · 0.85
SetMethod · 0.80
GetMethod · 0.80
DeleteMethod · 0.80

Tested by

no test coverage detected