module TorrentSpec (spec) where


import Test.Hspec
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as B8
import System.Random

import Torrent
import SpecAssets


spec = do
    describe "mkPeerId" $ do
        it "should return a string of 20 bytes length" $ do
            gen <- getStdGen
            length (mkPeerId gen) `shouldBe` 20

    describe "mkTorrent" $ do
        it "should return a Torrent" $ do
            bc <- ubuntuTorrent
            let (Just torrent) = mkTorrent bc
            torrentInfoHash torrent `shouldBe` ubuntuInfoHash
            torrentPieceCount torrent `shouldBe` ubuntuPieceCount
            torrentAnnounceURL torrent `shouldBe` ubuntuAnnounceURL



