html-to-md/test/html_to_md/transformer_test.clj
Johan Mynhardt (MEA) 4aa6bf978f 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
```
2022-05-21 16:19:57 +02:00

14 lines
515 B
Clojure

(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)))))))