aboutsummaryrefslogtreecommitdiff
path: root/specs/Specs
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-14 13:04:36 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-14 13:04:36 +0530
commit9368c616e202fc67c15d6128a2110d05998f4290 (patch)
treeba30236841d12e24e9b8b84b42579d2148c1445d /specs/Specs
parent7ab99bd80e30d0cc2cf21e4cda47870821b8fd47 (diff)
downloadchelleport-9368c616e202fc67c15d6128a2110d05998f4290.tar.gz
chelleport-9368c616e202fc67c15d6128a2110d05998f4290.zip
Move the mouse to the cell position after key sequence match
Diffstat (limited to 'specs/Specs')
-rw-r--r--specs/Specs/KeySequenceSpec.hs17
1 files changed, 16 insertions, 1 deletions
diff --git a/specs/Specs/KeySequenceSpec.hs b/specs/Specs/KeySequenceSpec.hs
index 570f1f9..d094741 100644
--- a/specs/Specs/KeySequenceSpec.hs
+++ b/specs/Specs/KeySequenceSpec.hs
@@ -1,6 +1,6 @@
module Specs.KeySequenceSpec where
-import Chelleport.KeySequence (generateKeyCells, nextChars)
+import Chelleport.KeySequence (findMatchPosition, generateKeyCells, nextChars)
import Test.Hspec
test = do
@@ -37,3 +37,18 @@ test = do
["HJA", "HJB", "LJA", "LJB"],
["HJA", "HJB", "LJA", "LJB"]
]
+
+ describe "#findMatchPosition" $ do
+ it "returns the position of the matching key sequence" $ do
+ findMatchPosition "ABD" [["XYZ", "ABC"], ["AMK", "BBL", "ABD"]]
+ `shouldBe` Just (1, 2)
+
+ context "when sequence is incomplete" $ do
+ it "returns nothing" $ do
+ findMatchPosition "AB" [["XYZ", "ABC"], ["AMK", "BBL", "ABD"]]
+ `shouldBe` Nothing
+
+ context "when there are no matches" $ do
+ it "returns nothing" $ do
+ findMatchPosition "FOO" [["XYZ", "ABC"], ["AMK", "BBL", "ABD"]]
+ `shouldBe` Nothing