aboutsummaryrefslogtreecommitdiff
path: root/specs/Specs/AppStateUpdateSpec.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--specs/Specs/AppStateUpdateSpec.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/specs/Specs/AppStateUpdateSpec.hs b/specs/Specs/AppStateUpdateSpec.hs
new file mode 100644
index 0000000..0b5cac0
--- /dev/null
+++ b/specs/Specs/AppStateUpdateSpec.hs
@@ -0,0 +1,20 @@
+module Specs.AppStateUpdateSpec where
+
+import Chelleport (update)
+import Chelleport.Types
+import Mock
+import Test.Hspec
+
+test = do
+ describe "#update" $ do
+ context "with action TriggerLeftClick" $ do
+ let state = State {stateKeySequence = [], stateIsShiftPressed = False, stateIsMatched = False, stateGrid = []}
+
+ it "hides window and triggers left clicks" $ do
+ (_, mock) <- runWithMocks $ update state TriggerLeftClick
+ calls mock `shouldContain` [CallHideWindow, CallPressMouseButton LeftClick]
+
+ it "continues with action ShutdownApp without updating state" $ do
+ ((state, action), mock) <- runWithMocks $ update state TriggerLeftClick
+ action `shouldBe` Just ShutdownApp
+ state `shouldBe` state