update recordGoalAssists test

This commit is contained in:
Jonathan Lamothe 2019-10-03 02:29:12 -04:00
parent 9d04abecff
commit de7f3f7a3e

View File

@ -369,9 +369,10 @@ recordGoalAssistsSpec = describe "recordGoalAssists" $ do
bob = newPlayer 2 "Bob" "defense" bob = newPlayer 2 "Bob" "defense"
steve = newPlayer 3 "Steve" "forward" steve = newPlayer 3 "Steve" "forward"
dave = newPlayer 4 "Dave" "somewhere" dave = newPlayer 4 "Dave" "somewhere"
frank = newPlayer 5 "Frank" "elsewhere"
ps ps
= newProgState = newProgState
& database.dbPlayers .~ [joe, bob, steve, dave] & database.dbPlayers .~ [joe, bob, steve, dave, frank]
& progMode.gameStateL & progMode.gameStateL
%~ (goalBy ?~ 0) %~ (goalBy ?~ 0)
. (assistsBy .~ [1, 2]) . (assistsBy .~ [1, 2])
@ -379,26 +380,35 @@ recordGoalAssistsSpec = describe "recordGoalAssists" $ do
& recordGoalAssists & recordGoalAssists
mapM_ mapM_
(\(name, n, ytdg, ltg, ytda, lta) -> context name $ do (\(name, n, goals, assists) -> context name $ do
let player = (ps^.database.dbPlayers) !! n let
player = (ps^.database.dbPlayers) !! n
stats = M.findWithDefault newPlayerStats n $
ps^.progMode.gameStateL.gamePlayerStats
it ("should set the year-to-date goals to " ++ show ytdg) $ it ("should set the year-to-date goals to " ++ show goals) $
player^.pYtd.psGoals `shouldBe` ytdg player^.pYtd.psGoals `shouldBe` goals
it ("should set the lifetime goals to " ++ show ltg) $ it ("should set the lifetime goals to " ++ show goals) $
player^.pLifetime.psGoals `shouldBe` ltg player^.pLifetime.psGoals `shouldBe` goals
it ("should set the year-to-date assists to " ++ show ytda) $ it ("should set the game goals to " ++ show goals) $
player^.pYtd.psAssists `shouldBe` ytda stats^.psAssists `shouldBe` assists
it ("should set the lifetime assists to " ++ show lta) $ it ("should set the year-to-date assists to " ++ show assists) $
player^.pLifetime.psAssists `shouldBe` lta) player^.pYtd.psAssists `shouldBe` assists
-- name, index, ytd goals, lt goals, ytd assists, lt assists it ("should set the lifetime assists to " ++ show assists) $
[ ( "Joe", 0, 1, 1, 0, 0 ) player^.pLifetime.psAssists `shouldBe` assists
, ( "Bob", 1, 0, 0, 1, 1 )
, ( "Steve", 2, 0, 0, 1, 1 ) it ("should set the game assists to " ++ show assists) $
, ( "Dave", 3, 0, 0, 0, 0 ) stats^.psAssists `shouldBe` assists)
-- name, index, goals, assists
[ ( "Joe", 0, 1, 0 )
, ( "Bob", 1, 0, 1 )
, ( "Steve", 2, 0, 1 )
, ( "Dave", 3, 0, 0 )
] ]
it "should clear the goalBy value" $ it "should clear the goalBy value" $