implemented playerDetails
This commit is contained in:
parent
0194f68996
commit
b3af06b53d
@ -863,7 +863,17 @@ playerSummary p =
|
|||||||
|
|
||||||
-- | Provides a detailed string describing a 'Player'
|
-- | Provides a detailed string describing a 'Player'
|
||||||
playerDetails :: Player -> String
|
playerDetails :: Player -> String
|
||||||
playerDetails = undefined
|
playerDetails p = unlines
|
||||||
|
[ " Number: " ++ show (p^.pNumber)
|
||||||
|
, " Name: " ++ p^.pName
|
||||||
|
, " Position: " ++ p^.pPosition
|
||||||
|
, " YTD goals: " ++ show (p^.pYtd.psGoals)
|
||||||
|
, " YTD assists: " ++ show (p^.pYtd.psAssists)
|
||||||
|
, " YTD penalty mins: " ++ show (p^.pYtd.psPMin)
|
||||||
|
, " Lifetime goals: " ++ show (p^.pLifetime.psGoals)
|
||||||
|
, " Lifetime assists: " ++ show (p^.pLifetime.psAssists)
|
||||||
|
, "Lifetime penalty mins: " ++ show (p^.pLifetime.psPMin)
|
||||||
|
]
|
||||||
|
|
||||||
-- | Determines whether or not a player has been active in the current
|
-- | Determines whether or not a player has been active in the current
|
||||||
-- season/year
|
-- season/year
|
||||||
|
@ -63,6 +63,7 @@ spec = describe "Mtlstats.Types" $ do
|
|||||||
playerSearchExactSpec
|
playerSearchExactSpec
|
||||||
modifyPlayerSpec
|
modifyPlayerSpec
|
||||||
playerSummarySpec
|
playerSummarySpec
|
||||||
|
playerDetailsSpec
|
||||||
playerIsActiveSpec
|
playerIsActiveSpec
|
||||||
psPointsSpec
|
psPointsSpec
|
||||||
addPlayerStatsSpec
|
addPlayerStatsSpec
|
||||||
@ -608,6 +609,36 @@ playerSummarySpec = describe "playerSummary" $
|
|||||||
it "should be \"Joe (2) center\"" $
|
it "should be \"Joe (2) center\"" $
|
||||||
playerSummary joe `shouldBe` "Joe (2) center"
|
playerSummary joe `shouldBe` "Joe (2) center"
|
||||||
|
|
||||||
|
playerDetailsSpec :: Spec
|
||||||
|
playerDetailsSpec = describe "playerDetails" $
|
||||||
|
it "should give a detailed description" $ let
|
||||||
|
|
||||||
|
player = newPlayer 1 "Joe" "centre"
|
||||||
|
& pYtd .~ PlayerStats
|
||||||
|
{ _psGoals = 2
|
||||||
|
, _psAssists = 3
|
||||||
|
, _psPMin = 4
|
||||||
|
}
|
||||||
|
& pLifetime .~ PlayerStats
|
||||||
|
{ _psGoals = 5
|
||||||
|
, _psAssists = 6
|
||||||
|
, _psPMin = 7
|
||||||
|
}
|
||||||
|
|
||||||
|
expected = unlines
|
||||||
|
[ " Number: 1"
|
||||||
|
, " Name: Joe"
|
||||||
|
, " Position: centre"
|
||||||
|
, " YTD goals: 2"
|
||||||
|
, " YTD assists: 3"
|
||||||
|
, " YTD penalty mins: 4"
|
||||||
|
, " Lifetime goals: 5"
|
||||||
|
, " Lifetime assists: 6"
|
||||||
|
, "Lifetime penalty mins: 7"
|
||||||
|
]
|
||||||
|
|
||||||
|
in playerDetails player `shouldBe` expected
|
||||||
|
|
||||||
playerIsActiveSpec :: Spec
|
playerIsActiveSpec :: Spec
|
||||||
playerIsActiveSpec = describe "playerIsActive" $ do
|
playerIsActiveSpec = describe "playerIsActive" $ do
|
||||||
let
|
let
|
||||||
|
Loading…
x
Reference in New Issue
Block a user