diff --git a/src/test/dda/masto_embed/browser_test.cljs b/src/test/dda/masto_embed/browser_test.cljs new file mode 100644 index 0000000..564c09c --- /dev/null +++ b/src/test/dda/masto_embed/browser_test.cljs @@ -0,0 +1,22 @@ +(ns dda.masto-embed.browser-test + (:require + [cljs.test :refer (deftest is)] + [hickory.core :as h] + [shadow.resource :as rc] + [clojure.walk :as w] + [dda.masto-embed.browser :as sut])) + + +(defn post-html [] + (h/as-hiccup + (h/parse + (rc/inline "dda/masto_embed/resources/post.html")))) + +(defn post-html-no-media [] + (h/as-hickory + (h/parse + (rc/inline "dda/masto_embed/resources/post-min.html")))) + +(deftest should-remove-media + (is (= (post-html-no-media) + (sut/remove-image-elem)))) diff --git a/src/test/dda/masto_embed/resources/post-min.html b/src/test/dda/masto_embed/resources/post-min.html new file mode 100644 index 0000000..5faf549 --- /dev/null +++ b/src/test/dda/masto_embed/resources/post-min.html @@ -0,0 +1,12 @@ +
+
+
+ +
+ DISPLAY_NAME + +
+ +
+
+
\ No newline at end of file diff --git a/src/test/dda/masto_embed/resources/post-no-media.html b/src/test/dda/masto_embed/resources/post-no-media.html new file mode 100644 index 0000000..4ed904d --- /dev/null +++ b/src/test/dda/masto_embed/resources/post-no-media.html @@ -0,0 +1,43 @@ +
+
+
+ +
+ DISPLAY_NAME + +
+ +
+
+

POST_TEXT

+
+ + +
+

LINK_PREVIEW_TITLE

+
LINK_PREVIEW_DESC
+
LINK_PREVIEW_URL
+
+
+ +
+
\ No newline at end of file diff --git a/src/test/dda/masto_embed/resources/post.html b/src/test/dda/masto_embed/resources/post.html new file mode 100644 index 0000000..fc51288 --- /dev/null +++ b/src/test/dda/masto_embed/resources/post.html @@ -0,0 +1,44 @@ +
+
+
+ +
+ DISPLAY_NAME + +
+ +
+
+

POST_TEXT

+ +
+ + +
+

LINK_PREVIEW_TITLE

+
LINK_PREVIEW_DESC
+
LINK_PREVIEW_URL
+
+
+ +
+
\ No newline at end of file