diff --git a/pkg/cache/cache_test.go b/pkg/cache/cache_test.go index f1642c88b..072cbcbbe 100644 --- a/pkg/cache/cache_test.go +++ b/pkg/cache/cache_test.go @@ -24,6 +24,8 @@ import ( "sync" "testing" "time" + + testifyassert "github.com/stretchr/testify/assert" ) var ( @@ -185,6 +187,16 @@ func TestCacheKeys(t *testing.T) { } } +func TestItems(t *testing.T) { + tc := New(DefaultExpiration, 0) + tc.Set(v1, "1", 1) + tc.Set(v2, "2", DefaultExpiration) + tc.Set(v3, "3", DefaultExpiration) + m := tc.Items() + assert := testifyassert.New(t) + assert.Equal(map[string]Item{"bar": {Object: "2", Expiration: 0}, "baz": {Object: "3", Expiration: 0}}, m) +} + func TestItemCount(t *testing.T) { tc := New(DefaultExpiration, 0) tc.Set(v1, "1", DefaultExpiration)