blob: 0b5cac0b61ff9b41a3f9ffeb7b507e3357d9990a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
|