Add test for transform java.lang.ClassCastException

When `obj` argument is a string (X)HTML payload and
not a string URL or URI, the following exception is
thrown:

```clojure
java.lang.ClassCastException: class java.lang.Class cannot be cast to class clojure.lang.IFn
```
This commit is contained in:
Johan Mynhardt (MEA) 2022-05-21 16:19:57 +02:00
parent ebd6230bdb
commit 4aa6bf978f

View file

@ -0,0 +1,13 @@
(ns html-to-md.transformer-test
(:require
[clojure.string :as str]
[clojure.test :as t :refer [deftest is testing]]
[html-to-md.html-to-md :refer [markdown-dispatcher]]
[html-to-md.transformer :refer [transform]]))
(deftest transform-payload
(testing "String `obj` for: 3. A string representation of an (X)HTML fragment;"
(is (= "# This is a header"
(str/trim (-> "<h1>This is a header"
(transform markdown-dispatcher)
(first)))))))