summaryrefslogtreecommitdiff
path: root/test/clj/nicktodo/handler_test.clj
diff options
context:
space:
mode:
Diffstat (limited to 'test/clj/nicktodo/handler_test.clj')
-rw-r--r--test/clj/nicktodo/handler_test.clj27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/clj/nicktodo/handler_test.clj b/test/clj/nicktodo/handler_test.clj
new file mode 100644
index 0000000..72a93d0
--- /dev/null
+++ b/test/clj/nicktodo/handler_test.clj
@@ -0,0 +1,27 @@
+(ns nicktodo.handler-test
+ (:require
+ [clojure.test :refer :all]
+ [ring.mock.request :refer :all]
+ [nicktodo.handler :refer :all]
+ [nicktodo.middleware.formats :as formats]
+ [muuntaja.core :as m]
+ [mount.core :as mount]))
+
+(defn parse-json [body]
+ (m/decode formats/instance "application/json" body))
+
+(use-fixtures
+ :once
+ (fn [f]
+ (mount/start #'nicktodo.config/env
+ #'nicktodo.handler/app-routes)
+ (f)))
+
+(deftest test-app
+ (testing "main route"
+ (let [response ((app) (request :get "/"))]
+ (is (= 200 (:status response)))))
+
+ (testing "not-found route"
+ (let [response ((app) (request :get "/invalid"))]
+ (is (= 404 (:status response))))))