blob: 72a93d03f566c5049e077642cad191a07deaabe7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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))))))
|