This commit is contained in:
2026-02-03 12:22:47 -05:00
parent a3c01d4b5a
commit 9150c90ad1
9 changed files with 1643 additions and 218 deletions
+13 -12
View File
@@ -152,26 +152,27 @@
;; The current implementation only looks at first char
(is (input/key-match? [:key {:char \q}] "quit")))
(testing "nil message returns nil"
(is (nil? (input/key-match? nil "q")))
(is (nil? (input/key-match? nil :enter))))
(testing "nil message returns false"
(is (not (input/key-match? nil "q")))
(is (not (input/key-match? nil :enter))))
(testing "non-key message returns nil"
(is (nil? (input/key-match? [:tick 123] "q")))
(is (nil? (input/key-match? [:http-success 200] :enter)))
(is (nil? (input/key-match? "not a vector" "q"))))
(testing "non-key message returns false"
(is (not (input/key-match? [:tick 123] "q")))
(is (not (input/key-match? [:http-success 200] :enter)))
(is (not (input/key-match? "not a vector" "q"))))
(testing "unknown key message structure"
(is (not (input/key-match? [:key {:unknown true}] "q")))
(is (not (input/key-match? [:key {}] "q")))))
(deftest key-str-edge-cases-test
(testing "nil message returns nil"
(is (nil? (input/key->str nil))))
(testing "nil message returns empty string"
(is (= "" (input/key->str nil))))
(testing "non-key message returns nil"
(is (nil? (input/key->str [:tick 123])))
(is (nil? (input/key->str [:custom :message]))))
(testing "non-key message returns string representation"
;; Legacy format returns the second element as string
(is (string? (input/key->str [:tick 123])))
(is (string? (input/key->str [:custom :message]))))
(testing "key message with empty map"
(is (= "" (input/key->str [:key {}]))))