be pedantic
This commit is contained in:
@@ -81,13 +81,13 @@ recordGoalieStatsSpec = describe "recordGoalieStats" $ let
|
||||
& progMode.gameStateL .~ gameState n mins goals
|
||||
|
||||
in mapM_
|
||||
(\(name, gid, mins, goals, joeData, bobData, reset) -> let
|
||||
s = recordGoalieStats $ progState gid mins goals
|
||||
in context name $ do
|
||||
(\(setName, setGid, mins, goals, joeData, bobData, reset) -> let
|
||||
s = recordGoalieStats $ progState setGid mins goals
|
||||
in context setName $ do
|
||||
|
||||
mapM_
|
||||
(\( name
|
||||
, gid
|
||||
(\( chkName
|
||||
, chkGid
|
||||
, ( gGames
|
||||
, gMins
|
||||
, gGoals
|
||||
@@ -98,11 +98,11 @@ recordGoalieStatsSpec = describe "recordGoalieStats" $ let
|
||||
, ltMins
|
||||
, ltGoals
|
||||
)
|
||||
) -> context name $ do
|
||||
) -> context chkName $ do
|
||||
let
|
||||
gs = s^.progMode.gameStateL.gameGoalieStats
|
||||
game = M.findWithDefault newGoalieStats gid gs
|
||||
goalie = fromJust $ nth gid $ s^.database.dbGoalies
|
||||
game = M.findWithDefault newGoalieStats chkGid gs
|
||||
goalie = fromJust $ nth chkGid $ s^.database.dbGoalies
|
||||
ytd = goalie^.gYtd
|
||||
lt = goalie^.gLifetime
|
||||
|
||||
@@ -120,7 +120,7 @@ recordGoalieStatsSpec = describe "recordGoalieStats" $ let
|
||||
]
|
||||
|
||||
context "selected goalie" $ let
|
||||
expected = if reset then Nothing else gid
|
||||
expected = if reset then Nothing else setGid
|
||||
in it ("should be " ++ show expected) $
|
||||
(s^.progMode.gameStateL.gameSelectedGoalie) `shouldBe` expected
|
||||
|
||||
@@ -211,16 +211,16 @@ setGameGoalieSpec = describe "setGameGoalie" $ let
|
||||
tiedGame = gameState 0 1 True
|
||||
|
||||
in mapM_
|
||||
(\(label, gameState, gid, bobData, joeData) -> context label $ let
|
||||
(\(setLabel, gs, setGid, bobData, joeData) -> context setLabel $ let
|
||||
|
||||
progState = newProgState
|
||||
& database.dbGoalies .~ [bob, joe]
|
||||
& progMode.gameStateL .~ gameState
|
||||
& setGameGoalie gid
|
||||
& progMode.gameStateL .~ gs
|
||||
& setGameGoalie setGid
|
||||
|
||||
in mapM_
|
||||
(\( label
|
||||
, gid
|
||||
(\( chkLabel
|
||||
, chkGid
|
||||
, ( gWins
|
||||
, gLosses
|
||||
, gTies
|
||||
@@ -231,16 +231,16 @@ setGameGoalieSpec = describe "setGameGoalie" $ let
|
||||
, ltLosses
|
||||
, ltTies
|
||||
)
|
||||
) -> context label $ do
|
||||
) -> context chkLabel $ do
|
||||
let
|
||||
goalie = (progState^.database.dbGoalies) !! gid
|
||||
goalie = (progState^.database.dbGoalies) !! chkGid
|
||||
gameStats = progState^.progMode.gameStateL.gameGoalieStats
|
||||
game = M.findWithDefault newGoalieStats gid gameStats
|
||||
game = M.findWithDefault newGoalieStats chkGid gameStats
|
||||
ytd = goalie^.gYtd
|
||||
lifetime = goalie^.gLifetime
|
||||
|
||||
mapM_
|
||||
(\(label, expected, actual) -> context label $
|
||||
(\(label', expected, actual) -> context label' $
|
||||
expected `TS.compareTest` actual)
|
||||
[ ( "game stats", game, goalieStats gWins gLosses gTies )
|
||||
, ( "YTD stats", ytd, goalieStats ytdWins ytdLosses ytdTies )
|
||||
|
||||
@@ -327,20 +327,20 @@ awardGoalSpec = describe "awardGoal" $ do
|
||||
& database .~ db
|
||||
|
||||
mapM_
|
||||
(\(pName, pid, ytd, lt, game) ->
|
||||
context pName $ do
|
||||
(\(name, pid, ytd, lt, game) ->
|
||||
context name $ do
|
||||
let
|
||||
ps' = awardGoal pid ps
|
||||
player = (ps'^.database.dbPlayers) !! pid
|
||||
gStats = (ps'^.progMode.gameStateL.gamePlayerStats) M.! pid
|
||||
|
||||
it ("should increment " ++ pName ++ "'s year-to-date goals") $
|
||||
it ("should increment " ++ name ++ "'s year-to-date goals") $
|
||||
player^.pYtd.psGoals `shouldBe` ytd
|
||||
|
||||
it ("should increment " ++ pName ++ "'s lifetime goals") $
|
||||
it ("should increment " ++ name ++ "'s lifetime goals") $
|
||||
player^.pLifetime.psGoals `shouldBe` lt
|
||||
|
||||
it ("should increment " ++ pName ++ "'s game goals") $
|
||||
it ("should increment " ++ name ++ "'s game goals") $
|
||||
gStats^.psGoals `shouldBe` game)
|
||||
-- player name, player id, ytd goals, lifetime goals, game goals
|
||||
[ ( "Joe", 0, 2, 3, 2 )
|
||||
@@ -377,20 +377,20 @@ awardAssistSpec = describe "awardAssist" $ do
|
||||
& database.dbPlayers .~ [joe, bob]
|
||||
|
||||
mapM_
|
||||
(\(pName, pid, ytd, lt, game) ->
|
||||
context pName $ do
|
||||
(\(name, pid, ytd, lt, game) ->
|
||||
context name $ do
|
||||
let
|
||||
ps' = awardAssist pid ps
|
||||
player = (ps'^.database.dbPlayers) !! pid
|
||||
gStats = (ps'^.progMode.gameStateL.gamePlayerStats) M.! pid
|
||||
|
||||
it ("should increment " ++ pName ++ "'s year-to-date assists") $
|
||||
it ("should increment " ++ name ++ "'s year-to-date assists") $
|
||||
player^.pYtd.psAssists `shouldBe` ytd
|
||||
|
||||
it ("should increment " ++ pName ++ "'s lifetime assists") $
|
||||
it ("should increment " ++ name ++ "'s lifetime assists") $
|
||||
player^.pLifetime.psAssists `shouldBe` lt
|
||||
|
||||
it ("should increment " ++ pName ++ "'s game assists") $
|
||||
it ("should increment " ++ name ++ "'s game assists") $
|
||||
gStats^.psAssists `shouldBe` game)
|
||||
-- player name, player id, ytd assists, lifetime assists, game assists
|
||||
[ ( "Joe", 0, 2, 3, 2 )
|
||||
|
||||
Reference in New Issue
Block a user