implemented editGoalieLtGames

This commit is contained in:
Jonathan Lamothe 2019-11-14 02:17:13 -05:00
parent 6b1aa85010
commit afdb7653cd
2 changed files with 33 additions and 1 deletions

View File

@ -108,7 +108,7 @@ editGoalieLtGames
-- ^ The number of games
-> ProgState
-> ProgState
editGoalieLtGames = undefined
editGoalieLtGames games = editGoalie (gLifetime.gsGames .~ games) EGLifetime
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do

View File

@ -39,6 +39,7 @@ spec = describe "EditGoalie" $ do
editGoalieYtdWinsSpec
editGoalieYtdLossesSpec
editGoalieYtdTiesSpec
editGoalieLtGamesSpec
editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -288,6 +289,37 @@ editGoalieYtdTiesSpec = describe "editGoalieYtdTies" $ editTest
)
]
editGoalieLtGamesSpec :: Spec
editGoalieLtGamesSpec = describe "editGoalieLtGames" $ editTest
(editGoalieLtGames 1)
EGLtGames
(\(num, name, games) -> newGoalie num name & gLifetime.gsGames .~ games)
[ ( "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 )
, EGLtGames
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGLtGames
)
]
editTest
:: (ProgState -> ProgState)
-> EditGoalieMode