implemented unaccountedPoints helper function
This commit is contained in:
@@ -50,6 +50,7 @@ spec = describe "Mtlstats.Types" $ do
|
||||
gameWonSpec
|
||||
gameLostSpec
|
||||
gameTiedSpec
|
||||
unaccountedPointsSpec
|
||||
gmsGamesSpec
|
||||
gmsPointsSpec
|
||||
addGameStatsSpec
|
||||
@@ -399,6 +400,35 @@ gameTiedSpec = describe "gameTied" $ mapM_
|
||||
, ( Just 1, Just 2, Just False )
|
||||
]
|
||||
|
||||
unaccountedPointsSpec :: Spec
|
||||
unaccountedPointsSpec = describe "unaccounted points" $ do
|
||||
context "no data" $
|
||||
it "should return Nothing" $
|
||||
unaccountedPoints newGameState `shouldBe` Nothing
|
||||
|
||||
context "unaccounted points" $
|
||||
it "should return True" $ let
|
||||
gs = newGameState
|
||||
& gameType ?~ HomeGame
|
||||
& homeScore ?~ 1
|
||||
in unaccountedPoints gs `shouldBe` Just True
|
||||
|
||||
context "all points accounted" $
|
||||
it "should return False" $ let
|
||||
gs = newGameState
|
||||
& gameType ?~ HomeGame
|
||||
& homeScore ?~ 1
|
||||
& pointsAccounted .~ 1
|
||||
in unaccountedPoints gs `shouldBe` Just False
|
||||
|
||||
context "more points accounted" $
|
||||
it "should return True" $ let
|
||||
gs = newGameState
|
||||
& gameType ?~ HomeGame
|
||||
& homeScore ?~ 1
|
||||
& pointsAccounted .~ 2
|
||||
in unaccountedPoints gs `shouldBe` Just False
|
||||
|
||||
gmsGamesSpec :: Spec
|
||||
gmsGamesSpec = describe "gmsGames" $ mapM_
|
||||
(\(w, l, ot, expected) -> let
|
||||
|
||||
Reference in New Issue
Block a user