implemented editGoalieYtdGoals
This commit is contained in:
parent
817c3c3fed
commit
cb5aa63469
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user