diff options
author | Miguel Ángel Moreno <mail@migalmoreno.com> | 2023-06-12 00:40:41 +0200 |
---|---|---|
committer | Miguel Ángel Moreno <mail@migalmoreno.com> | 2023-06-12 11:59:11 +0200 |
commit | 210978214ba512ae8174cfd1889f0424592eecbc (patch) | |
tree | 8c862cbaa32672deb841babe3d929630479e75ea | |
parent | 0b9fa69eadb6ddea29ed89936f522dea34a9fa4c (diff) |
feat(tests): Adapt to new API
-rw-r--r-- | tests/router.lisp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/router.lisp b/tests/router.lisp index 541cbd0..f23d8c5 100644 --- a/tests/router.lisp +++ b/tests/router.lisp @@ -5,76 +5,76 @@ (defparameter *redirector-with-list-rule* (make-instance 'router:redirector - :trigger (match-domain *url*) + :route (match-domain *url*) :redirect-url "atlas.engineer" :redirect-rule '(("/community/" . "/c/") ("/about/" . (not "/" "/v/"))))) (defparameter *redirector-with-regexp-trigger* (make-instance 'router:redirector - :trigger "https://(\\w+)\\.atlas.engineer/(.*)" + :route "https://(\\w+)\\.atlas.engineer/(.*)" :redirect-url "https://atlas.engineer/\\1/\\2")) (defparameter *redirector-with-regexp-rule* (make-instance 'router:redirector - :trigger (match-domain *url*) + :route (match-domain *url*) :redirect-url "https://atlas.engineer/\\1/\\2" :redirect-rule "https://(\\w+)\\.atlas.engineer/(.*)")) (defparameter *redirector-with-nonstandard-port-and-scheme* (make-instance 'router:redirector - :trigger (match-domain *url*) + :route (match-domain *url*) :redirect-url (quri:uri "http://atlas.engineer:8080"))) (defparameter *blocker-with-list-blocklist* (make-instance 'router:blocker - :trigger (match-domain *url*) + :route (match-domain *url*) :blocklist '(:path (:starts "/about" :ends "/work") :host (:starts "nyxt" :contains "atlas")))) (defparameter *blocker-with-list-blocklist-or-rules* (make-instance 'router:blocker - :trigger (match-domain *url*) + :route (match-domain *url*) :blocklist '(:or (:path (:or (:starts "/about") (:ends "/work"))) (:host (:or (:starts "nyxt") (:contains "atlas")))))) (defparameter *blocker-with-regexp-blocklist* (make-instance 'router:blocker - :trigger (match-domain *url*) + :route (match-domain *url*) :blocklist "/(^nyxt)|work")) (define-test redirector-with-list-rule () (assert-equality #'quri:uri= (quri:uri "https://atlas.engineer/") - (nx-router::compute-route *redirector-with-list-rule* (quri:uri *url*))) + (nx-router::compute-router *redirector-with-list-rule* (quri:uri *url*))) (assert-equality #'quri:uri= (quri:uri "https://atlas.engineer/") - (nx-router::compute-route *redirector-with-list-rule* + (nx-router::compute-router *redirector-with-list-rule* (quri:make-uri :defaults *url* :path "/"))) (assert-equality #'quri:uri= (quri:uri "https://atlas.engineer/about/example") - (nx-router::compute-route *redirector-with-list-rule* + (nx-router::compute-router *redirector-with-list-rule* (quri:make-uri :defaults *url* :path "/example"))) (assert-equality #'quri:uri= (quri:uri "https://atlas.engineer/community/1234") - (nx-router::compute-route *redirector-with-list-rule* + (nx-router::compute-router *redirector-with-list-rule* (quri:make-uri :defaults *url* :path "/c/1234"))) (assert-equality #'quri:uri= (quri:uri "https://atlas.engineer/v/1234") - (nx-router::compute-route *redirector-with-list-rule* + (nx-router::compute-router *redirector-with-list-rule* (quri:make-uri :defaults *url* :path "/v/1234")))) (define-test redirector-with-nonstandard-port-and-scheme () (assert-equality #'quri:uri= (quri:uri "http://atlas.engineer:8080/articles") - (nx-router::compute-route *redirector-with-nonstandard-port-and-scheme* + (nx-router::compute-router *redirector-with-nonstandard-port-and-scheme* (quri:make-uri :defaults *url* :path "/articles")))) (define-test redirector-with-regexp-trigger () (assert-equality #'quri:uri= (quri:uri "https://atlas.engineer/nyxt/contact") - (nx-router::compute-route *redirector-with-regexp-trigger* + (nx-router::compute-router *redirector-with-regexp-trigger* (quri:make-uri :defaults *url* :host "nyxt.atlas.engineer" :path "/contact")))) @@ -82,44 +82,44 @@ (define-test redirector-with-regexp-rule () (assert-equality #'quri:uri= (quri:uri "https://atlas.engineer/nyxt/contact") - (nx-router::compute-route *redirector-with-regexp-rule* + (nx-router::compute-router *redirector-with-regexp-rule* (quri:make-uri :defaults *url* :host "nyxt.atlas.engineer" :path "/contact")))) (define-test blocker-with-list-rule () - (assert-false (nx-router::compute-route *blocker-with-list-blocklist* + (assert-false (nx-router::compute-router *blocker-with-list-blocklist* (quri:make-uri :defaults *url* :path "/about/work"))) - (assert-false (nx-router::compute-route *blocker-with-list-blocklist* + (assert-false (nx-router::compute-router *blocker-with-list-blocklist* (quri:make-uri :defaults *url* :host "nyxt.atlas.engineer"))) - (assert-true (nx-router::compute-route *blocker-with-list-blocklist* + (assert-true (nx-router::compute-router *blocker-with-list-blocklist* (quri:make-uri :defaults *url* :host "nyxt.atlas.engineer" :path "/about/work")))) (define-test blocker-with-list-rule-or-rules () - (assert-true (nx-router::compute-route *blocker-with-list-blocklist-or-rules* + (assert-true (nx-router::compute-router *blocker-with-list-blocklist-or-rules* (quri:make-uri :defaults *url* :path "/about/work"))) - (assert-true (nx-router::compute-route *blocker-with-list-blocklist-or-rules* + (assert-true (nx-router::compute-router *blocker-with-list-blocklist-or-rules* (quri:make-uri :defaults *url* :host "nyxt.atlas.engineer"))) - (assert-true (nx-router::compute-route *blocker-with-list-blocklist-or-rules* + (assert-true (nx-router::compute-router *blocker-with-list-blocklist-or-rules* (quri:make-uri :defaults *url* :host "nyxt.atlas.engineer" :path "/about/work"))) - (assert-false (nx-router::compute-route *blocker-with-list-blocklist-or-rules* + (assert-false (nx-router::compute-router *blocker-with-list-blocklist-or-rules* (quri:make-uri :defaults *url*)))) (define-test blocker-with-regexp-rule () - (assert-true (nx-router::compute-route *blocker-with-regexp-blocklist* + (assert-true (nx-router::compute-router *blocker-with-regexp-blocklist* (quri:make-uri :defaults *url* :path "/work"))) - (assert-false (nx-router::compute-route *blocker-with-regexp-blocklist* + (assert-false (nx-router::compute-router *blocker-with-regexp-blocklist* (quri:make-uri :defaults *url* :path "/nyxt"))) - (assert-false (nx-router::compute-route *blocker-with-regexp-blocklist* + (assert-false (nx-router::compute-router *blocker-with-regexp-blocklist* (quri:make-uri :defaults *url* :path "/contact")))) |