summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-10-04 17:06:03 +0800
committereltrac <hi@eltr.ac>2026-10-04 17:07:10 +0800
commit61afc1a7cc45a1ab3a5d141c1a490badf3ea03ef (patch)
tree7158a08f04af53b6437f54486850f611559a8160 /test
parentb13b6ad1c2e9127412583760ff3d75e0e958e207 (diff)
API: remove typed API
- /api/likes removed - /api/replies removed - /api/reposts removed
Diffstat (limited to 'test')
-rw-r--r--test/weepinbell/handler_test.clj40
1 files changed, 14 insertions, 26 deletions
diff --git a/test/weepinbell/handler_test.clj b/test/weepinbell/handler_test.clj
index 5b0d8a6..a59dd5e 100644
--- a/test/weepinbell/handler_test.clj
+++ b/test/weepinbell/handler_test.clj
@@ -4,45 +4,33 @@
[weepinbell.handler :refer [app]]
[cheshire.core :refer [parse-string]]))
-(defmacro test-mention-list-by-domain-route [mftype]
- `(testing (str "/api/" ~mftype "/:domain route")
- (let [~'response ((app nil {:get-by-domain (fn [~'_]
+(deftest api-routes-test
+ (testing "/api/mentions/:domain route"
+ (let [response ((app nil {:get-by-domain (fn [_]
[{:webmention {:source ""
:target ""
:id ""
:modified 0}}])}
{})
- (mock/request :get (str "/api/" ~mftype "/www.example")))]
- (is (= (:status ~'response) 200))
- (is (some? (:body ~'response))))))
+ (mock/request :get "/api/mentions/www.example"))]
+ (is (= (:status response) 200))
+ (is (some? (:body response)))))
-(defmacro test-mention-list-by-url-route [mftype]
- `(testing (str "/api/" ~mftype "?url= route")
- (let [~'response ((app nil
+ (testing "/api/mentions?url= route"
+ (let [response ((app nil
{:get-by-domain
- (fn [~'_]
+ (fn [_]
[{:webmention {:source "https://source.net"
:target "http://localhost"
:id "123456789123456789"
:modified 0}
:microformats {:type :like-of}}])}
{})
- (mock/request :get (str "/api/" ~mftype "?url=http://localhost")))]
- (is (= (:status ~'response) 200))
- (is (some? (:body ~'response)))
- (when-not (-> ~'response :body parse-string empty?)
- (is (-> ~'response :body parse-string first (get "webmention") some?))))))
-
-(deftest api-routes-test
- (test-mention-list-by-domain-route "mentions")
- (test-mention-list-by-domain-route "likes")
- (test-mention-list-by-domain-route "reposts")
- (test-mention-list-by-domain-route "replies")
-
- (test-mention-list-by-url-route "mentions")
- (test-mention-list-by-url-route "likes")
- (test-mention-list-by-url-route "reposts")
- (test-mention-list-by-url-route "replies")
+ (mock/request :get "/api/mentions?url=http://localhost"))]
+ (is (= (:status response) 200))
+ (is (some? (:body response)))
+ (when-not (-> response :body parse-string empty?)
+ (is (-> response :body parse-string first (get "webmention") some?)))))
(testing "/api/mention/:id"
(let [response ((app nil {:get (fn [_]