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

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

[nongnu] elpa/webpaste fd4332a 172/298: Merge branch 'test-providers-on-


From: ELPA Syncer
Subject: [nongnu] elpa/webpaste fd4332a 172/298: Merge branch 'test-providers-on-travis'
Date: Thu, 9 Dec 2021 19:00:08 -0500 (EST)

branch: elpa/webpaste
commit fd4332a879a47e80cac3a06620bb4421a89746d0
Merge: 95de0b8 1677cd2
Author: Elis Axelsson <elis.axelsson@gmail.com>
Commit: Elis Axelsson <elis.axelsson@gmail.com>

    Merge branch 'test-providers-on-travis'
    
    This refs #16.
---
 Makefile                                     |  9 ++++++++
 tests/integration/test-webpaste-providers.el | 33 ++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/Makefile b/Makefile
index 77d0d0c..2425745 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,4 @@
+TRAVIS_EVENT_TYPE ?= push
 EMACS ?= emacs
 CASK ?= cask
 
@@ -14,6 +15,14 @@ test:
 unit:
        ${CASK} exec buttercup -L . tests/unit/
 
+       @if [ "$(TRAVIS_EVENT_TYPE)" = "cron" ]; then \
+               ${MAKE} integration;                      \
+       fi
+
+# Run all tests in tests/integration/
+integration:
+       ${CASK} exec buttercup -L . tests/integration/
+
 build:
        ${CASK} build
 
diff --git a/tests/integration/test-webpaste-providers.el 
b/tests/integration/test-webpaste-providers.el
new file mode 100644
index 0000000..38db120
--- /dev/null
+++ b/tests/integration/test-webpaste-providers.el
@@ -0,0 +1,33 @@
+;;; test-webpaste-providers.el --- Tests for webpaste providers
+;;; Commentary:
+;;; Code:
+
+(load "tests/load-undercover.el")
+(require 'webpaste)
+
+
+(describe
+ "Test all providers with dummy data"
+
+ (before-each
+  ;; Block requests
+  (spy-on 'webpaste-paste-text)
+  (spy-on 'webpaste-return-url))
+
+ (it
+  "can paste with ptpb.pw"
+
+  (let ((provider (cadr (assoc "ptpb.pw" webpaste-providers-alist))))
+    (funcall provider ";; This is my test text" :sync t)
+
+    (expect (spy-calls-count 'webpaste-return-url) :to-equal 1)
+    (expect (spy-calls-count 'webpaste-paste-text) :to-equal 0)
+
+    (expect (spy-calls-most-recent 'webpaste-return-url)
+            :to-equal
+            (make-spy-context :current-buffer (current-buffer)
+                              :args '("https://ptpb.pw/Dj5w";)
+                              :return-value nil)))))
+
+
+;;; test-webpaste-providers.el ends here



reply via email to

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