1
0
Fork 0

Fix tests for inserting a summary

This commit is contained in:
Bram Schoenmakers 2024-02-22 23:29:46 +01:00
parent 602b7dffb4
commit fa402763fa
Signed by: bram
GPG key ID: 0CCD19DFDC63258F

View file

@ -383,7 +383,8 @@ https://www.example.com"
(before-each
(spy-on #'kagi-summarize :and-return-value dummy-output)
(spy-on #'read-string :and-return-value "https://www.example.com")
(spy-on #'kagi--get-summarizer-parameters :and-return-value '(nil lang bram random)))
(spy-on #'kagi--get-summarizer-parameters :and-return-value '(nil lang bram random))
(spy-on #'kagi--insert-summary))
(it "passes arguments to kagi-summary"
(call-interactively #'kagi-summarize-url)
(kagi-test--expect-arg #'kagi-summarize 1 :to-equal 'lang)
@ -392,6 +393,7 @@ https://www.example.com"
(it "opens a buffer with the summary"
(call-interactively #'kagi-summarize-url)
(expect #'kagi--display-summary :to-have-been-called)
(expect #'kagi--insert-summary :not :to-have-been-called)
(kagi-test--expect-arg #'kagi--display-summary 0 :to-equal dummy-output))
(it "opens a buffer with the domain name for an HTTPS URL"
(call-interactively #'kagi-summarize-url)
@ -417,7 +419,7 @@ https://www.example.com"
(call-interactively #'kagi-summarize-url)
(expect #'kagi--display-summary :to-have-been-called)
(kagi-test--expect-arg #'kagi--display-summary 1 :to-equal "abc.example.com (summary)"))
(xit "inserts the summary when requested non-interactively"
(it "inserts the summary when requested non-interactively"
(kagi-summarize-url "https://www.example.com" t)
(expect #'kagi--display-summary :not :to-have-been-called)
(expect #'kagi--insert-summary :to-have-been-called)