diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-19 22:40:41 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-12-19 22:40:41 +0530 |
| commit | 5dc3696f38433c79939bb182c4590a6ce04f4c63 (patch) | |
| tree | 4329988cad9afa9c58f8a4c66419d23bc0ddc55d /specs/Specs/AppStateUpdateSpec.hs | |
| parent | d44103add77718ae650bc0ad5e708e984192c29d (diff) | |
| download | chelleport-5dc3696f38433c79939bb182c4590a6ce04f4c63.tar.gz chelleport-5dc3696f38433c79939bb182c4590a6ce04f4c63.zip | |
Test mock setup for update + 1 spec for update case
Diffstat (limited to '')
| -rw-r--r-- | specs/Specs/AppStateUpdateSpec.hs | 20 |
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 |
