1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module Specs.KeySequenceSpec where
import Chelleport.KeySequence (nextChars)
import Test.Hspec
test = do
describe "#nextChars" $ do
it "filters key sequence and returns next characters" $ do
nextChars "AB" [["XYZ", "ABC"], ["AMK", "BBL", "ABD"]]
`shouldBe` Just "CD"
nextChars "A" [["XYZ", "ABC"], ["AMK", "BBL", "ABD"]]
`shouldBe` Just "BM"
context "when exact match is present" $ do
it "returns next characters" $ do
nextChars "ABD" [["XYZ", "ABC"], ["AMK", "BBL", "ABD"]]
`shouldBe` Just ""
context "when there are no matches" $ do
it "returns nothing" $ do
nextChars "FOO" [["XYZ", "ABC"], ["AMK", "BBL", "ABD"]]
`shouldBe` Nothing
|