implemented editGoalieYtdGames

This commit is contained in:
Jonathan Lamothe 2019-11-14 00:59:00 -05:00
parent f739db4203
commit 203650397e
2 changed files with 33 additions and 1 deletions

View File

@ -54,7 +54,7 @@ editGoalieYtdGames
-- ^ The number of games played
-> ProgState
-> ProgState
editGoalieYtdGames = undefined
editGoalieYtdGames games = editGoalie (gYtd.gsGames .~ games) EGYtd
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do

View File

@ -33,6 +33,7 @@ spec :: Spec
spec = describe "EditGoalie" $ do
editGoalieNumberSpec
editGoalieNameSpec
editGoalieYtdGamesSpec
editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -96,6 +97,37 @@ editGoalieNameSpec = describe "editGoalieName" $ editTest
)
]
editGoalieYtdGamesSpec :: Spec
editGoalieYtdGamesSpec = describe "editGoalieYtdGames" $ editTest
(editGoalieYtdGames 1)
EGYtdGames
(\(num, name, games) -> newGoalie num name & gYtd.gsGames .~ games)
[ ( "set Joe"
, Just 0
, ( 2, "Joe", 1 )
, ( 3, "Bob", 0 )
, EGYtd
)
, ( "set Bob"
, Just 1
, ( 2, "Joe", 0 )
, ( 3, "Bob", 1 )
, EGYtd
)
, ( "out of bounds"
, Just 2
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGYtdGames
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGYtdGames
)
]
editTest
:: (ProgState -> ProgState)
-> EditGoalieMode