implemented editHomeStandings
This commit is contained in:
@@ -24,20 +24,27 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
module Actions.EditStandingsSpec (spec) where
|
||||
|
||||
import Lens.Micro ((^.))
|
||||
import Test.Hspec (Spec, describe, it, shouldSatisfy)
|
||||
import Test.Hspec (Spec, describe, it, shouldBe, shouldSatisfy)
|
||||
|
||||
import Mtlstats.Actions.EditStandings
|
||||
import Mtlstats.Types
|
||||
|
||||
spec :: Spec
|
||||
spec = describe "EditStandings"
|
||||
editStandingsSpec
|
||||
spec = describe "EditStandings" $ mapM_
|
||||
(\(label, f, expected) -> describe label $ do
|
||||
let
|
||||
ps = newProgState
|
||||
ps' = f ps
|
||||
|
||||
editStandingsSpec :: Spec
|
||||
editStandingsSpec = describe "editStandings" $ let
|
||||
ps = newProgState
|
||||
ps' = editStandings ps
|
||||
in it "should set progMode to EditStandings" $
|
||||
ps'^.progMode `shouldSatisfy` \case
|
||||
EditStandings -> True
|
||||
_ -> False
|
||||
it "should set progMode to EditStandings" $
|
||||
ps'^.progMode `shouldSatisfy` \case
|
||||
(EditStandings _) -> True
|
||||
_ -> False
|
||||
|
||||
it ("should set editStandingsMode to " ++ show expected) $
|
||||
ps'^.progMode.editStandingsModeL `shouldBe` expected)
|
||||
|
||||
-- label, function, expected mode
|
||||
[ ( "editStandings", editStandings, ESMMenu )
|
||||
, ( "editHomeStandings", editHomeStandings, ESMHome )
|
||||
]
|
||||
|
||||
@@ -58,6 +58,7 @@ spec = describe "Mtlstats.Types" $ do
|
||||
createGoalieStateLSpec
|
||||
editPlayerStateLSpec
|
||||
editGoalieStateLSpec
|
||||
editStandingsModeLSpec
|
||||
teamScoreSpec
|
||||
otherScoreSpec
|
||||
homeTeamSpec
|
||||
@@ -191,6 +192,18 @@ editGoalieStateLSpec = describe "editGoalieStateL" $
|
||||
egs2 = newEditGoalieState
|
||||
& egsSelectedGoalie ?~ 2
|
||||
|
||||
editStandingsModeLSpec :: Spec
|
||||
editStandingsModeLSpec = describe "editStandingsModeL" $
|
||||
lensSpec editStandingsModeL
|
||||
-- getters
|
||||
[ ( "missing mode", MainMenu, ESMMenu )
|
||||
, ( "with mode", EditStandings ESMHome, ESMHome )
|
||||
]
|
||||
-- setters
|
||||
[ ( "set mode", MainMenu, ESMHome )
|
||||
, ( "change mode", EditStandings ESMMenu, ESMHome )
|
||||
]
|
||||
|
||||
teamScoreSpec :: Spec
|
||||
teamScoreSpec = describe "teamScore" $ do
|
||||
let
|
||||
@@ -957,3 +970,8 @@ instance Comparable CreateGoalieState where
|
||||
describe "cgsName" $
|
||||
it ("should be " ++ expected^.cgsName) $
|
||||
actual^.cgsName `shouldBe` expected^.cgsName
|
||||
|
||||
instance Comparable EditStandingsMode where
|
||||
compareTest actual expected =
|
||||
it ("should be " ++ show expected) $
|
||||
actual `shouldBe` expected
|
||||
|
||||
Reference in New Issue
Block a user