1
0
Fork 0

Add test for proper error handling by kagi-summarize

This commit is contained in:
Bram Schoenmakers 2024-04-10 07:22:36 +02:00
parent 21a7a2e175
commit 380c63a0c3
Signed by: bram
GPG key ID: 0CCD19DFDC63258F

View file

@ -359,7 +359,14 @@ https://www.example.com"
(it "caches by default for an invalid configuration value"
(setq kagi-summarizer-cache 'invalid)
(kagi-summarize just-enough-text-input)
(kagi-test--expect-object #'kagi--call-summarizer "cache" :to-equal t)))
(kagi-test--expect-object #'kagi--call-summarizer "cache" :to-equal t))
(it "handles empty output and returned errors from the API gracefully"
(spy-on #'kagi--call-api :and-return-value (kagi-test--error-output))
(spy-on #'kagi-summarize :and-call-through)
(expect (kagi-summarize just-enough-text-input) :to-throw)
(expect (spy-context-thrown-signal
(spy-calls-most-recent #'kagi-summarize))
:to-equal '(error "Too bad (42)"))))
(describe "kagi-summarize-buffer"
(before-each
(spy-on #'read-buffer)