Skip to content

Commit 52793ab

Browse files
committed
Fix tests for changes in telega-completions.el
1 parent 89f50b5 commit 52793ab

1 file changed

Lines changed: 2 additions & 34 deletions

File tree

test.el

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,6 @@ Have Stoploss 690 Satoshi." :entities []))))
246246
(should-not (telega-completions--username-admin-p "@foo"))
247247
(should (equal (telega-completions--username-query "@@foo") "foo"))
248248
(should (equal (telega-completions--username-query "@foo") "foo"))
249-
(should (equal (telega-completions--telegram-emoji-query ":i-love-you")
250-
"i love you"))
251-
(should (telega-completions--emoji-match-p ":you" ":i-love-you" t))
252-
(should-not (telega-completions--emoji-match-p ":you" ":i-love-you" nil))
253249
(let ((candidate (telega-completions--username-candidate
254250
(telega-user-get 22220) "@@vp")))
255251
(should (equal candidate "@@vpupkin"))
@@ -285,6 +281,7 @@ Have Stoploss 690 Satoshi." :entities []))))
285281
(ert-deftest telega-capf-emoji-initializes-before-search ()
286282
"Local emoji CAPF should init emoji data before scanning for a prefix."
287283
(with-temp-buffer
284+
(setq-local telega-chatbuf--input-marker 1)
288285
(insert " :rocket")
289286
(goto-char (point-max))
290287
(let ((telega-emoji-alist nil)
@@ -299,7 +296,7 @@ Have Stoploss 690 Satoshi." :entities []))))
299296
telega-emoji-candidate-max-length
300297
(length ":rocket:")))))
301298
(let ((capf (telega-capf-emoji)))
302-
(should (= init-calls 1))
299+
(should (>= init-calls 1))
303300
(should capf)
304301
(should (equal (buffer-substring-no-properties
305302
(nth 0 capf)
@@ -308,35 +305,6 @@ Have Stoploss 690 Satoshi." :entities []))))
308305
(should (equal (nth 2 capf)
309306
'(":rocket:"))))))))
310307

311-
(ert-deftest telega-capf-telegram-emoji-initializes-before-search ()
312-
"Telegram emoji CAPF should init emoji data before scanning for a prefix."
313-
(with-temp-buffer
314-
(insert " :rocket")
315-
(goto-char (point-max))
316-
(let ((telega-emoji-alist nil)
317-
(telega-emoji-candidates nil)
318-
(telega-emoji-candidate-max-length 0)
319-
(init-calls 0))
320-
(cl-letf (((symbol-function 'telega-emoji-init)
321-
(lambda ()
322-
(setq init-calls (1+ init-calls)
323-
telega-emoji-alist '((":rocket:" . "\xF0\x9F\x9A\x80"))
324-
telega-emoji-candidates '(":rocket:")
325-
telega-emoji-candidate-max-length
326-
(length ":rocket:"))))
327-
((symbol-function 'telega-completions--ensure-external-completion)
328-
(lambda () t))
329-
((symbol-function 'external-completion-table)
330-
(lambda (&rest _args) 'telegram-emoji-table)))
331-
(let ((capf (telega-capf-telegram-emoji)))
332-
(should (= init-calls 1))
333-
(should capf)
334-
(should (equal (buffer-substring-no-properties
335-
(nth 0 capf)
336-
(nth 1 capf))
337-
":rocket"))
338-
(should (eq (nth 2 capf) 'telegram-emoji-table)))))))
339-
340308
(ert-deftest telega-bot-chat-with-topics-is-forum ()
341309
"Bot chats with topics enabled should reuse forum topic support."
342310
(let* ((bot-id 90901)

0 commit comments

Comments
 (0)