emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/webpaste ddd2fca 186/298: Added tests for success lambdas


From: ELPA Syncer
Subject: [nongnu] elpa/webpaste ddd2fca 186/298: Added tests for success lambdas
Date: Thu, 9 Dec 2021 19:00:11 -0500 (EST)

branch: elpa/webpaste
commit ddd2fcacf4bfe239994b31fcd1685371eb8e7fb0
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>

    Added tests for success lambdas
---
 tests/unit/test-webpaste-success-lambdas.el | 50 +++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/tests/unit/test-webpaste-success-lambdas.el 
b/tests/unit/test-webpaste-success-lambdas.el
new file mode 100644
index 0000000..ab4a0d5
--- /dev/null
+++ b/tests/unit/test-webpaste-success-lambdas.el
@@ -0,0 +1,50 @@
+;;; test-webpaste-success-lambdas.el --- Tests for success lambdas
+;;; Commentary:
+;;; Code:
+
+(load "tests/load-undercover.el")
+(require 'webpaste)
+
+
+(describe
+ "Create lambdas to use on successes"
+
+ (before-each
+  (spy-on 'request-response-header :and-return-value "https://example.com/";)
+  (spy-on 'request-response-url :and-return-value "https://example.com/";)
+  (spy-on 'webpaste-return-url))
+
+ (it
+  "using a response header"
+
+  (let ((success-lambda (webpaste/providers-success-location-header)))
+    (funcall success-lambda :response "my fake response")
+
+    (expect 'webpaste-return-url
+            :to-have-been-called-with
+            "https://example.com/";)))
+
+
+ (it
+  "when using some request.el response thingy"
+  (let ((success-lambda (webpaste/providers-success-response-url)))
+    (funcall success-lambda :response "my fake response")
+
+    (expect 'webpaste-return-url
+            :to-have-been-called-with
+            "https://example.com/";)))
+
+
+ (it
+  "when returning a string with an url"
+
+  (let ((success-lambda (webpaste/providers-success-returned-string)))
+    (funcall success-lambda :data "\"https://example.com/\";
+")
+
+    (expect 'webpaste-return-url
+            :to-have-been-called-with
+            "https://example.com/";))))
+
+
+;;; test-webpaste-success-lambdas.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]