Add tests for nginx.conf directives #1

Merged
ccm merged 26 commits from ccm-test-nginx-directives into trunk 2025-06-14 21:54:22 +00:00
2 changed files with 15 additions and 1 deletions
Showing only changes of commit 7b8413ae57 - Show all commits

View File

@ -23,7 +23,7 @@ http {
# redirect requests ending in a forward slash # redirect requests ending in a forward slash
location ~ ^/(.+)/$ { location ~ ^/(.+)/$ {
return 302 /$1; return 301 /$1;
} }
location /css { location /css {

View File

@ -48,3 +48,17 @@ describe "http://miti.sh/index.html", ->
assert.same request\statusCode!, 200 assert.same request\statusCode!, 200
assert.same request\statusMessage!, "OK" assert.same request\statusMessage!, "OK"
assert.same request\body!\match("<title>(.*)</title>"), index_title assert.same request\body!\match("<title>(.*)</title>"), index_title
describe "http://miti.sh/posts/", ->
it "permanently redirects to http://miti.sh/posts", ->
request = req "http://miti.sh/posts/"
assert.same request\statusCode!, 301
assert.same request\statusMessage!, "Moved Permanently"
assert.same request\header!.Location, "http://miti.sh/posts"
describe "http://miti.sh/posts", ->
it "sends /posts/index.html", ->
request = req "http://miti.sh/posts"
assert.same request\statusCode!, 200
assert.same request\statusMessage!, "OK"
assert.same request\body!\match("<title>(.*)</title>"), "miti.sh · Posts"