implemented editGoalieYtdGoals

This commit is contained in:
Jonathan Lamothe 2019-11-14 01:32:20 -05:00
parent 817c3c3fed
commit cb5aa63469
2 changed files with 33 additions and 1 deletions

View File

@ -72,7 +72,7 @@ editGoalieYtdGoals
-- ^ The number of goals
-> ProgState
-> ProgState
editGoalieYtdGoals = undefined
editGoalieYtdGoals goals = editGoalie (gYtd.gsGoalsAllowed .~ goals) EGYtd
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do

View File

@ -35,6 +35,7 @@ spec = describe "EditGoalie" $ do
editGoalieNameSpec
editGoalieYtdGamesSpec
editGoalieYtdMinsSpec
editGoalieYtdGoalsSpec
editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -160,6 +161,37 @@ editGoalieYtdMinsSpec = describe "editGoalieYtdMins" $ editTest
)
]
editGoalieYtdGoalsSpec :: Spec
editGoalieYtdGoalsSpec = describe "editGoalieYtdGoals" $ editTest
(editGoalieYtdGoals 1)
EGYtdGoals
(\(num, name, goals) -> newGoalie num name & gYtd.gsGoalsAllowed .~ goals)
[ ( "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 )
, EGYtdGoals
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGYtdGoals
)
]
editTest
:: (ProgState -> ProgState)
-> EditGoalieMode