1
0
Fork 0

Remove irrelavant tests now we don't do our own formatting anymore

This commit is contained in:
Bram Schoenmakers 2024-07-23 21:44:32 +02:00
parent 714db74bb0
commit ea77e31713
Signed by: bram
GPG key ID: 0CCD19DFDC63258F

View file

@ -59,11 +59,6 @@ TEXT is the output text, optionally with a list of REFERENCES."
(error . (((code . 42)
(msg . "Too bad")))))))
(buttercup-define-matcher-for-binary-function
:to-be-equal-including-properties equal-including-properties
:expect-match-phrase "Expected `%A' to be equal (incl. properties) to %b, but `%A' was %a."
:expect-mismatch-phrase "Expected `%A' not to be equal (incl. properties) to %b, but `%A' was %a.")
(defmacro kagi-test--expect-arg (function-symbol num &rest expect-args)
"Check the argument NUM of the first call of FUNCTION-SYMBOL.
@ -91,26 +86,6 @@ The EXPECT-ARGS correspond to the arguments passed to the `expect' macro."
(before-each
(spy-on #'message)
(spy-on #'kagi--fastgpt-display-result))
(it "converts *bold* markup to a bold face"
(spy-on #'kagi--call-api :and-return-value (kagi-test--dummy-output "**bold**"))
(expect (kagi-fastgpt-prompt "foo")
:to-be-equal-including-properties
(propertize "bold" 'font-lock-face 'kagi-bold)))
(it "converts <b>bold</b> markup to a bold face"
(spy-on #'kagi--call-api :and-return-value (kagi-test--dummy-output "<b>bold</b>"))
(expect (kagi-fastgpt-prompt "foo")
:to-be-equal-including-properties
(propertize "bold" 'font-lock-face 'kagi-bold)))
(it "converts $italic$ markup to an italic face"
(spy-on #'kagi--call-api :and-return-value (kagi-test--dummy-output "$italic$"))
(expect (kagi-fastgpt-prompt "foo")
:to-be-equal-including-properties
(propertize "italic" 'font-lock-face 'kagi-italic)))
(it "converts ```code``` markup to a code face"
(spy-on #'kagi--call-api :and-return-value (kagi-test--dummy-output "```echo $*```"))
(expect (kagi-fastgpt-prompt "foo")
:to-be-equal-including-properties
(propertize "echo $*" 'font-lock-face 'kagi-code)))
(it "formats references properly"
(spy-on #'kagi--call-api
:and-return-value
@ -123,26 +98,20 @@ The EXPECT-ARGS correspond to the arguments passed to the `expect' macro."
(snippet . "Snippet $2$")
(url . "https://www.example.com")))))
(expect (kagi-fastgpt-prompt "foo")
:to-be-equal-including-properties
(format "Main text
:to-equal
"Main text
%s First title
%s
[1] First title
**Snippet 1**
https://www.example.org
%s Second title
Snippet %s
https://www.example.com"
(propertize "[1]" 'font-lock-face 'kagi-bold)
(propertize "Snippet 1" 'font-lock-face 'kagi-bold)
(propertize "[2]" 'font-lock-face 'kagi-bold)
(propertize "2" 'font-lock-face 'kagi-italic))))
[2] Second title
Snippet $2$
https://www.example.com"))
(it "inserts the output when requested"
(spy-on #'insert)
(kagi-fastgpt-prompt "foo" t)
;; one additional insert call is to fill the temporary buffer
;; for POST data
(expect #'insert :to-have-been-called-times 2)
(expect #'insert :to-have-been-called-times 1)
(expect #'insert :to-have-been-called-with dummy-output))
(it "does not insert the output by default"
(spy-on #'insert)