From dce3eb0bb96d9409c181409c7ae7cebcf548bf7d Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 16 May 2024 16:45:14 +0200 Subject: [PATCH] Add tests to fail --- src/test/dda/masto_embed/browser_test.cljs | 22 ++++++++++ .../dda/masto_embed/resources/post-min.html | 12 +++++ .../masto_embed/resources/post-no-media.html | 43 ++++++++++++++++++ src/test/dda/masto_embed/resources/post.html | 44 +++++++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 src/test/dda/masto_embed/browser_test.cljs create mode 100644 src/test/dda/masto_embed/resources/post-min.html create mode 100644 src/test/dda/masto_embed/resources/post-no-media.html create mode 100644 src/test/dda/masto_embed/resources/post.html 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 @@ +
+ +
\ 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 @@ +
+ +
\ 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 @@ +
+ +
\ No newline at end of file