-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements two test cases that validate whether a connection can be opened with SAM
- Loading branch information
Showing
5 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
module Network.Anonymous.I2P.ConnectSpec where | ||
|
||
import Control.Monad.Trans.Resource | ||
import Control.Monad.Error | ||
|
||
import Data.Either (isRight, isLeft) | ||
|
||
import Network.Anonymous.I2P (initialize) | ||
import Network.Anonymous.I2P.Types | ||
|
||
import Test.Hspec | ||
|
||
spec :: Spec | ||
spec = do | ||
describe "when initializing a context" $ do | ||
it "SAM should be listening at its default port" $ do | ||
result <- runResourceT $ runErrorT $ initialize "127.0.0.1" 7656 VirtualStream | ||
isRight result `shouldBe` True | ||
|
||
it "SAM should not be listening at another port" $ do | ||
result <- runResourceT $ runErrorT $ initialize "127.0.0.1" 1234 VirtualStream | ||
isLeft result `shouldBe` True |