Add test for set-routes

This commit is contained in:
Akira Tempaku 2024-12-22 18:33:49 +09:00
parent 234b2e50f3
commit 7641ec5f61
10 changed files with 115 additions and 9 deletions

8
tests/routes/hello.lisp Normal file
View file

@ -0,0 +1,8 @@
(defpackage #:ningle-fbr-test/routes/hello
(:use #:cl)
(:export #:handle-get))
(in-package #:ningle-fbr-test/routes/hello)
(defun handle-get (params)
(declare (ignore params))
"ok")

8
tests/routes/index.lisp Normal file
View file

@ -0,0 +1,8 @@
(defpackage #:ningle-fbr-test/routes/index
(:use #:cl)
(:export #:handle-get))
(in-package #:ningle-fbr-test/routes/index)
(defun handle-get (params)
(declare (ignore params))
"ok")

View file

@ -0,0 +1,8 @@
(defpackage #:ningle-fbr-test/routes/nested/page
(:use #:cl)
(:export #:handle-get))
(in-package #:ningle-fbr-test/routes/nested/page)
(defun handle-get (params)
(declare (ignore params))
"ok")

View file

@ -0,0 +1,11 @@
(defpackage #:ningle-fbr-test/routes/not-found
(:use #:cl)
(:import-from #:lack/response)
(:import-from #:ningle)
(:export #:handle-not-found))
(in-package #:ningle-fbr-test/routes/not-found)
(defun handle-not-found ()
(setf (lack/response:response-status ningle:*response*)
404)
"Not Found")

View file

@ -0,0 +1,8 @@
(defpackage #:ningle-fbr-test/routes/users/<id>
(:use #:cl)
(:export #:handle-get))
(in-package #:ningle-fbr-test/routes/users/<id>)
(defun handle-get (params)
(let ((id (cdr (assoc :id params))))
id))

View file

@ -0,0 +1,8 @@
(defpackage #:ningle-fbr-test/routes/users/index
(:use #:cl)
(:export #:handle-get))
(in-package #:ningle-fbr-test/routes/users/index)
(defun handle-get (params)
(declare (ignore params))
"ok")