diff options
| author | eltrac <hi@eltr.ac> | 2026-10-07 17:54:20 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-10-07 17:54:20 +0800 |
| commit | add243af59b54daa642e862136bd6f60f3bb2609 (patch) | |
| tree | 374dd6957d2c19f35b667b7801594cc75914af29 /test | |
| parent | 112a90906eef64bfd8080690a596490aaaf8c7c7 (diff) | |
handler: add /api/count #48
Diffstat (limited to 'test')
| -rw-r--r-- | test/weepinbell/handler_test.clj | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/weepinbell/handler_test.clj b/test/weepinbell/handler_test.clj index 0e46a22..a66c202 100644 --- a/test/weepinbell/handler_test.clj +++ b/test/weepinbell/handler_test.clj @@ -37,6 +37,26 @@ (when-not (-> response :body parse-string empty?) (is (-> response :body parse-string first (get "webmention") some?))))) + (testing "/api/count/:domain route" + (let [response ((test-app nil {:get-by-domain (fn [_] + [{:webmention {:source "" + :target "" + :id "" + :modified 0}}])} + {}) + (mock/request :get "/api/count/www.example.com"))] + (is (= (:status response) 200)) + (is (= 1 (-> response :body parse-string (get "count") Long.))))) + + (testing "/api/count?url= route" + (let [response ((test-app nil + {:get-by-domain + (fn [_] [])} + {}) + (mock/request :get "/api/count?url=http://localhost"))] + (is (= (:status response) 200)) + (is (= 0 (-> response :body parse-string (get "count") Long.))))) + (testing "/api/mention/:id" (let [response ((test-app nil {:get (fn [_] {:webmention {:source "" |
