diff --git a/t/mirror-img.lisp b/t/mirror-img.lisp index 1d7eb4d..3bf008f 100644 --- a/t/mirror-img.lisp +++ b/t/mirror-img.lisp @@ -38,58 +38,59 @@ (define-test mirror-img (:tags '(mirror-img)) (assert-eq + 'T (stringp (setq *mirror-img-result* (mirror-img:mirror-img (relative-pathname "t/testing-website/index.html") - "tmp"))) - 'T)) + "tmp"))))) (define-test mirror-img.files-mirrored (:tags '(mirror-img)) (assert-equal + '("café" "fireplace" "merry christmas!!! ^_^" "more_calming" "style" "welcoming you") (sort (mapcar #'pathname-name (uiop:directory-files (relative-pathname "t/tmp/localhost/"))) - #'string-lessp) - '("café" "fireplace" "merry christmas!!! ^_^" "more_calming" "style" "welcoming you"))) + #'string-lessp))) (define-test mirror-img.correct-urls (:tags '(mirror-img)) (assert-equal - (sort (mirror-img::linked-urls - (lquery:$ (lquery:initialize *mirror-img-result*))) - #'string-lessp) '("tmp/localhost/café.jpg" "tmp/localhost/classy_fireplace.jpg" "tmp/localhost/fireplace.jpg" "tmp/localhost/merry christmas!!! ^_^.jpg" "tmp/localhost/more_calming.jpg" "tmp/localhost/style.css" - "tmp/localhost/welcoming you.jpg"))) + "tmp/localhost/welcoming you.jpg") + (sort (mirror-img::linked-urls + (lquery:$ (lquery:initialize *mirror-img-result*))) + #'string-lessp))) (define-test mirrored-pathname (:tags '(base)) (assert-equal + #p"base/invalid.tld/bird apple.txt" (mirror-img::mirrored-pathname "https://invalid.tld/dir/bird apple.txt" - :base-dir #p"base/") - #p"base/invalid.tld/bird apple.txt")) + :base-dir #p"base/"))) (define-test linked-urls (:tags '(dom)) (assert-equal - (sort (mirror-img::linked-urls - (lquery:$ (lquery:initialize - (relative-pathname "t/testing-website/index.html")))) - #'string-lessp) '("http://localhost:4242/res/img/b/fireplace.jpg" "http://localhost:4242/res/img/b/I’m trying hard to randomly name these directories/more_calming.jpg" "http://localhost:4242/res/img/b/I’m trying hard to randomly name these directories/ĉu ĉi tio sufiĉe hazardas%3F!/classy_fireplace.jpg" "http://localhost:4242/res/img/level-2/café.jpg" "http://localhost:4242/res/img/merry christmas!!! ^_^.jpg" "http://localhost:4242/res/style.css" - "http://localhost:4242/res/welcoming you.jpg"))) + "http://localhost:4242/res/welcoming you.jpg") + (sort (mirror-img::linked-urls + (lquery:$ (lquery:initialize + (relative-pathname "t/testing-website/index.html")))) + #'string-lessp))) (define-test url-encode-uri.space (:tags '(util)) (assert-equal - (mirror-img::url-encode-uri "https://invalid.tld/dad alive.jpg") - "https://invalid.tld/dad%20alive.jpg")) + "https://invalid.tld/dad%20alive.jpg" + (mirror-img::url-encode-uri "https://invalid.tld/dad alive.jpg"))) (define-test url-encode-path.space+exclamation (:tags '(util)) (assert-equal - (mirror-img::url-encode-path "/images!/dad alive.jpg") - "/images%21/dad%20alive.jpg")) + "/images%21/dad%20alive.jpg" + (mirror-img::url-encode-path "/images!/dad alive.jpg"))) +