moved pPoints function

This commit is contained in:
Jonathan Lamothe 2019-08-28 01:46:09 -04:00
parent 2854c54474
commit e834019fc9

View File

@ -40,10 +40,10 @@ spec = describe "Mtlstats.Types" $ do
goalieSpec goalieSpec
gameStatsSpec gameStatsSpec
databaseSpec databaseSpec
pPointsSpec
gameStateLSpec gameStateLSpec
teamScoreSpec teamScoreSpec
otherScoreSpec otherScoreSpec
pPointsSpec
Menu.spec Menu.spec
playerSpec :: Spec playerSpec :: Spec
@ -59,24 +59,6 @@ gameStatsSpec = describe "GameStats" $
databaseSpec :: Spec databaseSpec :: Spec
databaseSpec = describe "Database" $ jsonSpec db dbJSON databaseSpec = describe "Database" $ jsonSpec db dbJSON
pPointsSpec :: Spec
pPointsSpec = describe "pPoints" $ mapM_
(\(goals, assists, points) -> let
desc = "goals: " ++ show goals ++
", assists: " ++ show assists
stats = newPlayerStats &
psGoals .~ goals &
psAssists .~ assists
in context desc $
it ("should be " ++ show points) $
pPoints stats `shouldBe` points)
-- goals, assists, points
[ ( 0, 0, 0 )
, ( 1, 0, 1 )
, ( 0, 1, 1 )
, ( 2, 3, 5 )
]
gameStateLSpec :: Spec gameStateLSpec :: Spec
gameStateLSpec = describe "gameStateL" $ lensSpec gameStateL gameStateLSpec = describe "gameStateL" $ lensSpec gameStateL
-- getters -- getters
@ -260,3 +242,21 @@ dbJSON = Object $ HM.fromList
, ( "home_game_stats", gameStatsJSON 1 ) , ( "home_game_stats", gameStatsJSON 1 )
, ( "away_game_stats", gameStatsJSON 2 ) , ( "away_game_stats", gameStatsJSON 2 )
] ]
pPointsSpec :: Spec
pPointsSpec = describe "pPoints" $ mapM_
(\(goals, assists, points) -> let
desc = "goals: " ++ show goals ++
", assists: " ++ show assists
stats = newPlayerStats &
psGoals .~ goals &
psAssists .~ assists
in context desc $
it ("should be " ++ show points) $
pPoints stats `shouldBe` points)
-- goals, assists, points
[ ( 0, 0, 0 )
, ( 1, 0, 1 )
, ( 0, 1, 1 )
, ( 2, 3, 5 )
]