implemented editGoalieYtdWins

This commit is contained in:
Jonathan Lamothe 2019-11-14 01:47:15 -05:00
parent a8a5d6a305
commit 14da1096cd
2 changed files with 33 additions and 1 deletions

View File

@ -81,7 +81,7 @@ editGoalieYtdWins
-- ^ The number of wins
-> ProgState
-> ProgState
editGoalieYtdWins = undefined
editGoalieYtdWins wins = editGoalie (gYtd.gsWins .~ wins) EGYtd
editGoalie :: (Goalie -> Goalie) -> EditGoalieMode -> ProgState -> ProgState
editGoalie f mode s = fromMaybe s $ do

View File

@ -36,6 +36,7 @@ spec = describe "EditGoalie" $ do
editGoalieYtdGamesSpec
editGoalieYtdMinsSpec
editGoalieYtdGoalsSpec
editGoalieYtdWinsSpec
editGoalieNumberSpec :: Spec
editGoalieNumberSpec = describe "editGoalieNumber" $ editTest
@ -192,6 +193,37 @@ editGoalieYtdGoalsSpec = describe "editGoalieYtdGoals" $ editTest
)
]
editGoalieYtdWinsSpec :: Spec
editGoalieYtdWinsSpec = describe "editGoalieYtdWins" $ editTest
(editGoalieYtdWins 1)
EGYtdWins
(\(num, name, wins) -> newGoalie num name & gYtd.gsWins .~ wins)
[ ( "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 )
, EGYtdWins
)
, ( "no goalie selected"
, Nothing
, ( 2, "Joe", 0 )
, ( 3, "Bob", 0 )
, EGYtdWins
)
]
editTest
:: (ProgState -> ProgState)
-> EditGoalieMode