(t *testing.T)
| 64 | } |
| 65 | |
| 66 | func TestGet(t *testing.T) { |
| 67 | config.ConfigStore.Store(newTestRedisConfig(t)) |
| 68 | ctx := context.Background() |
| 69 | mockCache, err := NewCache() |
| 70 | assert.NoError(t, err) |
| 71 | |
| 72 | key := "testKey" |
| 73 | setValue := map[string]string{"hello": "world"} |
| 74 | err = mockCache.Set(ctx, key, setValue, 10*time.Minute) |
| 75 | assert.NoError(t, err) |
| 76 | |
| 77 | // Test getting an existing value |
| 78 | var getValue map[string]string |
| 79 | err = mockCache.Get(ctx, key, &getValue) |
| 80 | assert.NoError(t, err) |
| 81 | assert.Equal(t, setValue, getValue) |
| 82 | |
| 83 | var getValue1 map[string]string |
| 84 | // Test getting a non-existent key |
| 85 | err = mockCache.Get(ctx, "nonExistentKey", &getValue1) |
| 86 | assert.NoError(t, err) // Assuming Get returns no error for non-existent keys |
| 87 | assert.Empty(t, getValue1) |
| 88 | } |
| 89 | |
| 90 | func TestGetNonExistentKey(t *testing.T) { |
| 91 | config.ConfigStore.Store(newTestRedisConfig(t)) |
nothing calls this directly
no test coverage detected