From 6e9b81c9009140db4807bd51baadcf3be785ee15 Mon Sep 17 00:00:00 2001 From: Sam Truzjan Date: Wed, 19 Feb 2014 05:51:39 +0400 Subject: Add MonadActive instance for DHT --- tests/Network/BitTorrent/DHT/SessionSpec.hs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/Network/BitTorrent/DHT/SessionSpec.hs') 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 @@ {-# LANGUAGE ScopedTypeVariables #-} module Network.BitTorrent.DHT.SessionSpec (spec) where import Control.Monad.Reader +import Control.Monad.Trans.Resource import Data.Default import Data.List as L import Test.Hspec @@ -29,8 +30,19 @@ isRight (Right _) = True isLeft :: Either a b -> Bool isLeft = not . isRight +nullLogger :: LogFun +nullLogger _ _ _ _ = return () + spec :: Spec spec = do + describe "session" $ do + it "is active until stopNode called" $ do + node <- startNode [] def myAddr nullLogger + runDHT node monadActive `shouldReturn` True + runDHT node monadActive `shouldReturn` True + stopNode node + runDHT node monadActive `shouldReturn` False + describe "tokens" $ do it "should not complain about valid token" $ property $ \ (addrs :: [NodeAddr IPv4]) -> do -- cgit v1.2.3