Skip to content

Commit

Permalink
Added tests for get keys
Browse files Browse the repository at this point in the history
  • Loading branch information
tfonfara authored and ReneKroon committed Apr 8, 2021
1 parent 2e13de6 commit f4ea033
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,21 @@ func TestCacheGet(t *testing.T) {
assert.Equal(t, "world", (data.(string)), "Expected data content to be 'world'")
}

func TestCacheGetKeys(t *testing.T) {
t.Parallel()

cache := NewCache()
defer cache.Close()

keys := cache.GetKeys()
assert.Empty(t, keys, "Expected keys to be empty")

cache.Set("hello", "world")
keys = cache.GetKeys()
assert.NotEmpty(t, keys, "Expected keys to be not empty")
assert.Equal(t, []string {"hello"}, keys, "Expected keys contains 'world'")
}

func TestCacheExpirationCallbackFunction(t *testing.T) {
t.Parallel()

Expand Down

0 comments on commit f4ea033

Please sign in to comment.