aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-05 14:51:22 -0500
committerCraig Jennings <c@cjennings.net>2026-05-05 14:51:22 -0500
commit318044608dedd94dd69550c0365036935480554c (patch)
treeb27ebe273146971704c6ceca1b4fe353b8863ec9
parent14d75bc5c9a35e26f80944010a494d9589c26c2f (diff)
downloadorg-drill-318044608dedd94dd69550c0365036935480554c.tar.gz
org-drill-318044608dedd94dd69550c0365036935480554c.zip
test: cover present-simple-card-with-typed-answer
I added a test for `org-drill-present-simple-card-with-typed-answer' that mocks `prompt-for-string' and the surrounding hide-* helpers, then asserts the presenter forwards the session and returns the prompt's result. Coverage moved from 94.4% to 94.8%.
-rw-r--r--tests/test-org-drill-presentation-prompt.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test-org-drill-presentation-prompt.el b/tests/test-org-drill-presentation-prompt.el
index 2c81623..e330cbf 100644
--- a/tests/test-org-drill-presentation-prompt.el
+++ b/tests/test-org-drill-presentation-prompt.el
@@ -181,6 +181,24 @@ mentions the response keys."
(let ((result (org-drill-presentation-prompt-in-buffer session "p")))
(should (eq 'mock-result result))))))))
+;;;; org-drill-present-simple-card-with-typed-answer
+
+(ert-deftest test-present-simple-card-with-typed-answer-runs-prompt ()
+ "The typed-answer presenter calls `prompt-for-string' and returns its value."
+ (let ((called-with nil))
+ (cl-letf (((symbol-function 'org-drill-hide-all-subheadings-except) #'ignore)
+ ((symbol-function 'org-drill--show-latex-fragments) #'ignore)
+ ((symbol-function 'org-display-inline-images) #'ignore)
+ ((symbol-function 'org-drill-hide-drawers) #'ignore)
+ ((symbol-function 'org-drill-hide-subheadings-if) #'ignore)
+ ((symbol-function 'org-drill-presentation-prompt-for-string)
+ (lambda (s _p) (setq called-with s) 'prompt-result)))
+ (with-fresh-drill-entry
+ (let* ((session (org-drill-session))
+ (result (org-drill-present-simple-card-with-typed-answer session)))
+ (should (eq 'prompt-result result))
+ (should (eq session called-with)))))))
+
(provide 'test-org-drill-presentation-prompt)
;;; test-org-drill-presentation-prompt.el ends here