Initial Kit project with PostgreSQL, HTMX, Hiccup, and Tailwind
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
(ns pmagnus.elprice.core-test
|
||||
(:require
|
||||
[pmagnus.elprice.test-utils :as utils]
|
||||
[clojure.test :refer :all]))
|
||||
|
||||
(deftest example-test
|
||||
(is (= 1 2)))
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
(ns pmagnus.elprice.test-utils
|
||||
(:require
|
||||
[pmagnus.elprice.core :as core]
|
||||
[peridot.core :as p]
|
||||
[byte-streams :as bs]
|
||||
[integrant.repl.state :as state]))
|
||||
|
||||
(defn system-state
|
||||
[]
|
||||
(or @core/system state/system))
|
||||
|
||||
(defn system-fixture
|
||||
[]
|
||||
(fn [f]
|
||||
(when (nil? (system-state))
|
||||
(core/start-app {:opts {:profile :test}}))
|
||||
(f)
|
||||
(core/stop-app)))
|
||||
|
||||
(defn get-response [ctx]
|
||||
(-> ctx
|
||||
:response
|
||||
(update :body (fnil bs/to-string ""))))
|
||||
|
||||
(defn GET [app path params headers]
|
||||
(-> (p/session app)
|
||||
(p/request path
|
||||
:request-method :get
|
||||
:content-type "application/edn"
|
||||
:headers headers
|
||||
:params params)
|
||||
(get-response)))
|
||||
@@ -0,0 +1,13 @@
|
||||
(ns pmagnus.elprice.web.request-test
|
||||
(:require [clojure.test :refer [deftest testing is use-fixtures]]
|
||||
[pmagnus.elprice.test-utils :refer [system-state system-fixture GET]]))
|
||||
|
||||
(use-fixtures :once (system-fixture))
|
||||
|
||||
(deftest health-request-test []
|
||||
(testing "happy path"
|
||||
(let [handler (:handler/ring (system-state))
|
||||
params {}
|
||||
headers {}
|
||||
response (GET handler "/api/health" params headers)]
|
||||
(is (= 200 (:status response))))))
|
||||
Reference in New Issue
Block a user