Skip to content

Commit

Permalink
route test moved
Browse files Browse the repository at this point in the history
  • Loading branch information
awb99 committed Apr 14, 2024
1 parent b095353 commit 3c332df
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions demo-webly/test/webly/route_test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
(ns goldly.route-test-bad
(:require
[clojure.test :refer [deftest is testing]]
[ring.mock.request :refer [request] :rename {request mock-request}]
[bidi.bidi :as bidi]
[bidi.ring]
[goldly.web.routes :refer [goldly-routes-backend]]))

(defn GET [url]
(bidi/match-route goldly-routes-backend url :request-method :get))

(defn POST [url]
(bidi/match-route goldly-routes-backend url :request-method :post))

(defn handler [OP url]
(-> url OP :handler))

(deftest app-routes []
;(is (= #'goldly.web.handler/app-handler (handler GET "app")))
;(is (= #'goldly.web.handler/app-handler (handler GET "app/")))
(is (= :ui/system-list (handler GET "/")))
#_(is (= #'goldly.web.handler/app-handler (handler GET "/app/"))))

;(get-handler "/app/system/15")
;

(deftest app-routes-greedy []
(is (= :ui/system (handler GET "/system/15"))))

; websocket

(deftest ws-routes []
(is (= :ws/token (handler GET "/api/token")))
(is (= :ws/chsk-get (handler GET "/api/chsk")))
(is (= :ws/chsk-post (handler POST "/api/chsk"))))

(comment
(handler GET "aa")
(GET "aa")
(GET "/r/favicon.ico")
(handler GET "/r/favicon.ico")
(handler GET "favicon.ico")
(handler GET "//favicon.ico")

(handler GET "/tailwindcss/dist/tailwind.css")
(handler GET "/app")
(handler GET "/system/42")
(handler GET "/token")
(handler GET "/chsk")

;
)

0 comments on commit 3c332df

Please sign in to comment.