implemented resetCreatePlayerState and resetCreateGoalieState
This commit is contained in:
parent
2d2ee61aae
commit
667cf34475
|
@ -34,6 +34,8 @@ module Mtlstats.Actions
|
||||||
, createGoalie
|
, createGoalie
|
||||||
, addPlayer
|
, addPlayer
|
||||||
, addGoalie
|
, addGoalie
|
||||||
|
, resetCreatePlayerState
|
||||||
|
, resetCreateGoalieState
|
||||||
, recordGoalAssists
|
, recordGoalAssists
|
||||||
, awardGoal
|
, awardGoal
|
||||||
, awardAssist
|
, awardAssist
|
||||||
|
@ -172,6 +174,19 @@ addPlayer s = fromMaybe s $ do
|
||||||
addGoalie :: ProgState -> ProgState
|
addGoalie :: ProgState -> ProgState
|
||||||
addGoalie = undefined
|
addGoalie = undefined
|
||||||
|
|
||||||
|
-- | Resets the 'CreatePlayerState' value
|
||||||
|
resetCreatePlayerState :: ProgState -> ProgState
|
||||||
|
resetCreatePlayerState = progMode.createPlayerStateL
|
||||||
|
%~ (cpsNumber .~ Nothing)
|
||||||
|
. (cpsName .~ "")
|
||||||
|
. (cpsPosition .~ "")
|
||||||
|
|
||||||
|
-- | Resets the 'CreateGoalieState' value
|
||||||
|
resetCreateGoalieState :: ProgState -> ProgState
|
||||||
|
resetCreateGoalieState = progMode.createGoalieStateL
|
||||||
|
%~ (cgsNumber .~ Nothing)
|
||||||
|
. (cgsName .~ "")
|
||||||
|
|
||||||
-- | Awards the goal and assists to the players
|
-- | Awards the goal and assists to the players
|
||||||
recordGoalAssists :: ProgState -> ProgState
|
recordGoalAssists :: ProgState -> ProgState
|
||||||
recordGoalAssists ps = fromMaybe ps $ do
|
recordGoalAssists ps = fromMaybe ps $ do
|
||||||
|
|
|
@ -43,6 +43,8 @@ import Mtlstats.Actions
|
||||||
import Mtlstats.Types
|
import Mtlstats.Types
|
||||||
import Mtlstats.Util
|
import Mtlstats.Util
|
||||||
|
|
||||||
|
import qualified TypesSpec as TS
|
||||||
|
|
||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec = describe "Mtlstats.Actions" $ do
|
spec = describe "Mtlstats.Actions" $ do
|
||||||
startNewSeasonSpec
|
startNewSeasonSpec
|
||||||
|
@ -56,6 +58,8 @@ spec = describe "Mtlstats.Actions" $ do
|
||||||
createPlayerSpec
|
createPlayerSpec
|
||||||
createGoalieSpec
|
createGoalieSpec
|
||||||
addPlayerSpec
|
addPlayerSpec
|
||||||
|
resetCreatePlayerStateSpec
|
||||||
|
resetCreateGoalieStateSpec
|
||||||
recordGoalAssistsSpec
|
recordGoalAssistsSpec
|
||||||
awardGoalSpec
|
awardGoalSpec
|
||||||
awardAssistSpec
|
awardAssistSpec
|
||||||
|
@ -384,6 +388,25 @@ addPlayerSpec = describe "addPlayer" $ do
|
||||||
s' = addPlayer $ s MainMenu
|
s' = addPlayer $ s MainMenu
|
||||||
in s'^.database.dbPlayers `shouldBe` [p1]
|
in s'^.database.dbPlayers `shouldBe` [p1]
|
||||||
|
|
||||||
|
resetCreatePlayerStateSpec :: Spec
|
||||||
|
resetCreatePlayerStateSpec = describe "resetCreatePlayerState" $ let
|
||||||
|
cps = newCreatePlayerState
|
||||||
|
& cpsNumber ?~ 1
|
||||||
|
& cpsName .~ "Joe"
|
||||||
|
& cpsPosition .~ "centre"
|
||||||
|
ps = resetCreatePlayerState $
|
||||||
|
newProgState & progMode.createPlayerStateL .~ cps
|
||||||
|
in TS.compareTest (ps^.progMode.createPlayerStateL) newCreatePlayerState
|
||||||
|
|
||||||
|
resetCreateGoalieStateSpec :: Spec
|
||||||
|
resetCreateGoalieStateSpec = describe "resetCreateGoalieState" $ let
|
||||||
|
cgs = newCreateGoalieState
|
||||||
|
& cgsNumber ?~ 1
|
||||||
|
& cgsName .~ "Joe"
|
||||||
|
ps = resetCreateGoalieState $
|
||||||
|
newProgState & progMode.createGoalieStateL .~ cgs
|
||||||
|
in TS.compareTest (ps^.progMode.createGoalieStateL) newCreateGoalieState
|
||||||
|
|
||||||
recordGoalAssistsSpec :: Spec
|
recordGoalAssistsSpec :: Spec
|
||||||
recordGoalAssistsSpec = describe "recordGoalAssists" $ do
|
recordGoalAssistsSpec = describe "recordGoalAssists" $ do
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in New Issue
Block a user