packages feed

tweet-hs-1.0.1.4: test/Spec.hs

{-# LANGUAGE OverloadedStrings #-}

-- import qualified Data.ByteString             as BS
import           Data.Monoid
import           System.Environment
import           Test.Hspec
import           Web.Tweet.Parser.FastParser
import           Web.Tweet.Sign

main :: IO ()
main = hspec $ do
    describe "fastParse" $ do
        -- file <- runIO $ BS.readFile "test/data"
        config <- runIO $ (<> "/.cred") <$> getEnv "HOME"
        configToml <- runIO $ (<> "/.cred.toml") <$> getEnv "HOME"
        parallel $ it "parses sample tweets wrong" $ do
            fastParse "" `shouldBe` Left "Error in $: not enough input"
        parallel $ it "parses a config file the same way with the toml parser" $
            ((==) <$> mkConfigToml configToml <*> mkConfig config) >>= (`shouldBe` True)