summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-10-13 17:19:44 +0800
committereltrac <hi@eltr.ac>2026-10-13 17:19:44 +0800
commit5d851c82f9575f1709ddeb559c48f9daad449bbd (patch)
tree33fe13105793720f167d435b5c88da9697e9dbf9 /test
parente26cc530c5e51154117883894ff5779c8a8e3ba3 (diff)
wrapper: fix not downloading photo with relative urls
Diffstat (limited to 'test')
-rw-r--r--test/weepinbell/utils_url_test.clj12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/weepinbell/utils_url_test.clj b/test/weepinbell/utils_url_test.clj
index 732ba1c..d2f7c34 100644
--- a/test/weepinbell/utils_url_test.clj
+++ b/test/weepinbell/utils_url_test.clj
@@ -53,4 +53,16 @@
["http://www.example.com/index.php?page=123#anchor"]
(url/extract "complicated one (http://www.example.com/index.php?page=123#anchor)")))))
+(deftest relative-predicate-test
+ (testing "Check if a URL is relative"
+ (is (url/relative? "./asset/photo.png"))
+ (is (url/relative? "../photo.png"))
+ (is (url/relative? "/photo.png"))))
+
+(deftest get-base-test
+ (testing "Check if get-base works"
+ (is (= "https://source.net"
+ (url/get-base "https://source.net/page/index.php?param=value#test")))
+ (is (not= "https://source.net/"
+ (url/get-base "https://source.net/page/index.php?param=value#test")))))