MCPcopy
hub / github.com/gofiber/fiber / Test_Storage_Memory_Delete

Function Test_Storage_Memory_Delete

internal/storage/memory/memory_test.go:179–204  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

177}
178
179func Test_Storage_Memory_Delete(t *testing.T) {
180 t.Parallel()
181 var (
182 testStore = New()
183 key = "john"
184 val = []byte("doe")
185 )
186
187 err := testStore.Set(key, val, 0)
188 require.NoError(t, err)
189
190 keys, err := testStore.Keys()
191 require.NoError(t, err)
192 require.Len(t, keys, 1)
193
194 err = testStore.Delete(key)
195 require.NoError(t, err)
196
197 result, err := testStore.Get(key)
198 require.NoError(t, err)
199 require.Empty(t, result)
200
201 keys, err = testStore.Keys()
202 require.NoError(t, err)
203 require.Nil(t, keys)
204}
205
206func Test_Storage_Memory_DeleteWithContext(t *testing.T) {
207 t.Parallel()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.70
SetMethod · 0.65
LenMethod · 0.65
DeleteMethod · 0.65
GetMethod · 0.65
KeysMethod · 0.45

Tested by

no test coverage detected