Better test

This commit is contained in:
David Palm 2016-02-05 14:34:58 +01:00
parent d5307b40af
commit 3665b16e83

View file

@ -27,16 +27,11 @@ func (_ CacheTests) FetchesExpiredItems() {
cache := New(Configure())
fn := func() (interface{}, error) { return "moo-moo", nil }
cache.Set("beef", "moo", time.Second)
cache.Set("beef", "moo", time.Second*-1)
Expect(cache.Get("beef").Value()).To.Equal("moo")
out, _ := cache.Fetch("beef", time.Second, fn)
Expect(out.Value()).To.Equal("moo")
time.Sleep(2 * time.Second)
out2, _ := cache.Fetch("beef", time.Second, fn)
Expect(out2.Value()).To.Equal("moo-moo")
Expect(out.Value()).To.Equal("moo-moo")
}
func (_ CacheTests) GCsTheOldestItems() {