implemented gameTied helper function

This commit is contained in:
Jonathan Lamothe
2019-08-28 01:47:30 -04:00
parent e834019fc9
commit c15ad6a477
2 changed files with 25 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ spec = describe "Mtlstats.Types" $ do
gameStateLSpec
teamScoreSpec
otherScoreSpec
gameTiedSpec
pPointsSpec
Menu.spec
@@ -243,6 +244,23 @@ dbJSON = Object $ HM.fromList
, ( "away_game_stats", gameStatsJSON 2 )
]
gameTiedSpec = describe "gameTied" $ mapM_
(\(home, away, expected) -> let
desc = "home score: " ++ show home ++
", away score: " ++ show away
gs = newGameState
& homeScore .~ home
& awayScore .~ away
in context desc $
it ("should be " ++ show expected) $
gameTied gs `shouldBe` expected)
[ ( Nothing, Nothing, False )
, ( Nothing, Just 1, False )
, ( Just 1, Nothing, False )
, ( Just 1, Just 1, True )
, ( Just 1, Just 2, False )
]
pPointsSpec :: Spec
pPointsSpec = describe "pPoints" $ mapM_
(\(goals, assists, points) -> let