1
1
mirror of https://github.com/qfpl/applied-fp-course.git synced 2024-11-30 12:23:25 +03:00

Tests weren't passing for level06

Tests now pass for level06

need more tests
This commit is contained in:
Sean Chalmers 2017-08-17 08:54:02 +10:00
parent 3f3ac5b108
commit e06eae6695

View File

@ -12,7 +12,7 @@ import qualified FirstApp.Conf as Conf
import qualified FirstApp.DB as DB import qualified FirstApp.DB as DB
import qualified FirstApp.Main as Main import qualified FirstApp.Main as Main
import qualified FirstApp.Types as Types import qualified FirstApp.Types as Types
import qualified FirstApp.AppM as AppM
main :: IO () main :: IO ()
main = do main = do
let dieWith m = print m >> Exit.exitFailure let dieWith m = print m >> Exit.exitFailure
@ -22,17 +22,16 @@ main = do
Left err -> dieWith err Left err -> dieWith err
Right (cfg,db) -> do Right env -> do
let app' = pure ( Main.app cfg db ) let app' = pure ( Main.app env )
flushTopic = flushTopic =
-- Clean up and yell about our errors -- Clean up and yell about our errors
fmap ( either dieWith pure . join ) . fmap ( either dieWith pure . join ) .
-- Purge all of the comments for this topic for our tests -- Purge all of the comments for this topic for our tests
traverse ( DB.deleteTopic db ) traverse ( DB.deleteTopic (AppM.envDb env) )
-- We don't export the constructor so even for known values we have -- We don't export the constructor so even for known values we have
-- to play by the rules. There is no - "Oh just this one time.", do -- to play by the rules. There is no - "Oh just this one time.", do it right.
-- it right.
$ Types.mkTopic "fudge" $ Types.mkTopic "fudge"
-- Run the tests with a DB topic flush between each spec -- Run the tests with a DB topic flush between each spec