-
Notifications
You must be signed in to change notification settings - Fork 0
/
io_test.cljc
23 lines (19 loc) · 976 Bytes
/
io_test.cljc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
(ns mate.io-test
(:require [clojure.test :refer [deftest is testing]]
[mate.io :as mio]
#?(:clj [clojure.data.json :as json])))
(deftest inline-resource-test
(testing "Finds the resource using a relative path."
(is (= (mio/inline-resource (str "./" "test-resource.txt"))
"Content of test-resource.txt")))
(testing "Finds the resource using an absolute path."
(is (= (mio/inline-resource (str "mate/" "test-resource.txt"))
"Content of test-resource.txt")))
(testing "Reads and transform the content using multiple arguments."
(is (= (mio/inline-resource "./test-resource.txt"
str " FOO" " BAR")
"Content of test-resource.txt FOO BAR")))
(testing "Reads the JSON content as string and parse it to get a Clojure data structure."
(is (= (mio/inline-resource "./test-resource.json"
json/read-json)
[{:a 1} "hello"]))))