Remove irrelavant tests now we don't do our own formatting anymore
This commit is contained in:
parent
714db74bb0
commit
ea77e31713
1 changed files with 8 additions and 39 deletions
47
kagi-test.el
47
kagi-test.el
|
@ -59,11 +59,6 @@ TEXT is the output text, optionally with a list of REFERENCES."
|
||||||
(error . (((code . 42)
|
(error . (((code . 42)
|
||||||
(msg . "Too bad")))))))
|
(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)
|
(defmacro kagi-test--expect-arg (function-symbol num &rest expect-args)
|
||||||
"Check the argument NUM of the first call of FUNCTION-SYMBOL.
|
"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
|
(before-each
|
||||||
(spy-on #'message)
|
(spy-on #'message)
|
||||||
(spy-on #'kagi--fastgpt-display-result))
|
(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"
|
(it "formats references properly"
|
||||||
(spy-on #'kagi--call-api
|
(spy-on #'kagi--call-api
|
||||||
:and-return-value
|
:and-return-value
|
||||||
|
@ -123,26 +98,20 @@ The EXPECT-ARGS correspond to the arguments passed to the `expect' macro."
|
||||||
(snippet . "Snippet $2$")
|
(snippet . "Snippet $2$")
|
||||||
(url . "https://www.example.com")))))
|
(url . "https://www.example.com")))))
|
||||||
(expect (kagi-fastgpt-prompt "foo")
|
(expect (kagi-fastgpt-prompt "foo")
|
||||||
:to-be-equal-including-properties
|
:to-equal
|
||||||
(format "Main text
|
"Main text
|
||||||
|
|
||||||
%s First title
|
[1] First title
|
||||||
%s
|
**Snippet 1**
|
||||||
https://www.example.org
|
https://www.example.org
|
||||||
|
|
||||||
%s Second title
|
[2] Second title
|
||||||
Snippet %s
|
Snippet $2$
|
||||||
https://www.example.com"
|
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))))
|
|
||||||
(it "inserts the output when requested"
|
(it "inserts the output when requested"
|
||||||
(spy-on #'insert)
|
(spy-on #'insert)
|
||||||
(kagi-fastgpt-prompt "foo" t)
|
(kagi-fastgpt-prompt "foo" t)
|
||||||
;; one additional insert call is to fill the temporary buffer
|
(expect #'insert :to-have-been-called-times 1)
|
||||||
;; for POST data
|
|
||||||
(expect #'insert :to-have-been-called-times 2)
|
|
||||||
(expect #'insert :to-have-been-called-with dummy-output))
|
(expect #'insert :to-have-been-called-with dummy-output))
|
||||||
(it "does not insert the output by default"
|
(it "does not insert the output by default"
|
||||||
(spy-on #'insert)
|
(spy-on #'insert)
|
||||||
|
|
Loading…
Reference in a new issue