From bba14f6be37d6642a7d1d2c88359e307b0aacf77 Mon Sep 17 00:00:00 2001 From: Trolli Schmittlauch Date: Fri, 17 Apr 2020 17:23:30 +0200 Subject: [PATCH] add tests for entry deletion from cache --- Hash2Pub/test/FediChordSpec.hs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Hash2Pub/test/FediChordSpec.hs b/Hash2Pub/test/FediChordSpec.hs index 40c2d2a..ebd730e 100644 --- a/Hash2Pub/test/FediChordSpec.hs +++ b/Hash2Pub/test/FediChordSpec.hs @@ -107,6 +107,11 @@ spec = do cacheWithProxyNodeEntry <- addCacheEntry maxNode 0 =<< newCache nid. cacheGetNodeStateUnvalidated <$> cacheLookupPred (exampleID - 2) cacheWithProxyNodeEntry `shouldBe` Just maxBound nid. cacheGetNodeStateUnvalidated <$> cacheLookupSucc (anotherID + 2) cacheWithProxyNodeEntry `shouldBe` Just maxBound + it "entries can be deleted" $ do + nC <- addCacheEntry maxNode 0 =<< newCache + let nc' = deleteCacheEntry maxBound . deleteCacheEntry anotherID $ nC + cacheLookup anotherID nc' `shouldBe` Nothing + cacheLookup maxBound nc' `shouldBe` Nothing describe "NodeCache query lookup" $ do