diff options
Diffstat (limited to 'tests/Network/BitTorrent/DHT/SessionSpec.hs')
-rw-r--r-- | tests/Network/BitTorrent/DHT/SessionSpec.hs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/Network/BitTorrent/DHT/SessionSpec.hs b/tests/Network/BitTorrent/DHT/SessionSpec.hs index 381aa77d..343c8ab6 100644 --- a/tests/Network/BitTorrent/DHT/SessionSpec.hs +++ b/tests/Network/BitTorrent/DHT/SessionSpec.hs | |||
@@ -1,6 +1,7 @@ | |||
1 | {-# LANGUAGE ScopedTypeVariables #-} | 1 | {-# LANGUAGE ScopedTypeVariables #-} |
2 | module Network.BitTorrent.DHT.SessionSpec (spec) where | 2 | module Network.BitTorrent.DHT.SessionSpec (spec) where |
3 | import Control.Monad.Reader | 3 | import Control.Monad.Reader |
4 | import Control.Monad.Trans.Resource | ||
4 | import Data.Default | 5 | import Data.Default |
5 | import Data.List as L | 6 | import Data.List as L |
6 | import Test.Hspec | 7 | import Test.Hspec |
@@ -29,8 +30,19 @@ isRight (Right _) = True | |||
29 | isLeft :: Either a b -> Bool | 30 | isLeft :: Either a b -> Bool |
30 | isLeft = not . isRight | 31 | isLeft = not . isRight |
31 | 32 | ||
33 | nullLogger :: LogFun | ||
34 | nullLogger _ _ _ _ = return () | ||
35 | |||
32 | spec :: Spec | 36 | spec :: Spec |
33 | spec = do | 37 | spec = do |
38 | describe "session" $ do | ||
39 | it "is active until stopNode called" $ do | ||
40 | node <- startNode [] def myAddr nullLogger | ||
41 | runDHT node monadActive `shouldReturn` True | ||
42 | runDHT node monadActive `shouldReturn` True | ||
43 | stopNode node | ||
44 | runDHT node monadActive `shouldReturn` False | ||
45 | |||
34 | describe "tokens" $ do | 46 | describe "tokens" $ do |
35 | it "should not complain about valid token" $ | 47 | it "should not complain about valid token" $ |
36 | property $ \ (addrs :: [NodeAddr IPv4]) -> do | 48 | property $ \ (addrs :: [NodeAddr IPv4]) -> do |