implemented goalieIsActive

This commit is contained in:
Jonathan Lamothe 2019-11-28 05:12:59 -05:00
parent 3b6f77ba21
commit 4848e54d81
2 changed files with 20 additions and 1 deletions

View File

@ -989,4 +989,4 @@ goalieSummary g = g^.gName ++ " (" ++ show (g^.gNumber) ++ ")"
-- | Determines whether or not a goalie has been active in the current -- | Determines whether or not a goalie has been active in the current
-- season -- season
goalieIsActive :: Goalie -> Bool goalieIsActive :: Goalie -> Bool
goalieIsActive = undefined goalieIsActive g = g^.gYtd.gsMinsPlayed /= 0

View File

@ -78,6 +78,7 @@ spec = describe "Mtlstats.Types" $ do
goalieSearchSpec goalieSearchSpec
goalieSearchExactSpec goalieSearchExactSpec
goalieSummarySpec goalieSummarySpec
goalieIsActiveSpec
Menu.spec Menu.spec
playerSpec :: Spec playerSpec :: Spec
@ -753,6 +754,24 @@ goalieSummarySpec = describe "goalieSummary" $
it "should provide a summary string" $ it "should provide a summary string" $
goalieSummary (newGoalie 2 "Joe") `shouldBe` "Joe (2)" goalieSummary (newGoalie 2 "Joe") `shouldBe` "Joe (2)"
goalieIsActiveSpec :: Spec
goalieIsActiveSpec = describe "goalieIsActive" $ mapM_
(\(label, input, expected) -> context label $
it ("should be " ++ show expected) $
goalieIsActive input `shouldBe` expected)
-- label, input, expected
[ ( "inactive", inactive, False )
, ( "active", active, True )
]
where
inactive = newGoalie 1 "Joe"
& gLifetime.gsMinsPlayed .~ 1
active = inactive
& gYtd.gsMinsPlayed .~ 1
joe :: Player joe :: Player
joe = newPlayer 2 "Joe" "center" joe = newPlayer 2 "Joe" "center"