implemented editGoalieLtMins

This commit is contained in:
Jonathan Lamothe 2019-11-14 02:26:55 -05:00
parent 30cfea0503
commit 3a1480115d
2 changed files with 33 additions and 1 deletions

View File

@ -117,7 +117,7 @@ editGoalieLtMins
-- ^ The number of minutes
-> ProgState
-> ProgState
editGoalieLtMins = undefined
editGoalieLtMins mins = editGoalie (gLifetime.gsMinsPlayed .~ mins) EGLifetime
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do

View File

@ -40,6 +40,7 @@ spec = describe "EditGoalie" $ do
editGoalieYtdLossesSpec
editGoalieYtdTiesSpec
editGoalieLtGamesSpec
editGoalieLtMinsSpec
editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -320,6 +321,37 @@ editGoalieLtGamesSpec = describe "editGoalieLtGames" $ editTest
)
]
editGoalieLtMinsSpec :: Spec
editGoalieLtMinsSpec = describe "editGoalieLtMins" $ editTest
(editGoalieLtMins 1)
EGLtMins
(\(num, name, mins) -> newGoalie num name & gLifetime.gsMinsPlayed .~ mins)
[ ( "set Joe"
, Just 0
, ( 2, "Joe", 1 )
, ( 3, "Bob", 0 )
, EGLifetime
)
, ( "set Bob"
, Just 1
, ( 2, "Joe", 0 )
, ( 3, "Bob", 1 )
, EGLifetime
)
, ( "out of bounds"
, Just 2
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGLtMins
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGLtMins
)
]
editTest
:: (ProgState -> ProgState)
-> EditGoalieMode