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 8 deletions
Showing only changes of commit 54052e3890 - Show all commits

View File

@ -44,12 +44,12 @@ http {
return 301 http://miti.sh$request_uri; return 301 http://miti.sh$request_uri;
} }
location ~ ^/git/(.*)$ { location ~ ^/git/?(.*)$ {
return 301 https://git.miti.sh/ccm/$1; return 301 http://git.miti.sh/ccm/$1;
} }
location ~ ^/apps/(.*)$ { location ~ ^/apps/(.*)$ {
return 301 https://apps.miti.sh/$1; return 301 http://apps.miti.sh/$1;
} }
} }
} }

View File

@ -16,17 +16,24 @@ describe "http://webdevcat.me", ->
assert.same request\header!.Location, "http://miti.sh/" assert.same request\header!.Location, "http://miti.sh/"
describe "http://webdevcat.me/git", -> describe "http://webdevcat.me/git", ->
it "permanently redirects to http://git.miti.sh", -> it "permanently redirects to http://git.miti.sh/ccm/", ->
request = req "http://webdevcat.me/git" request = req "http://webdevcat.me/git"
assert.same request\header!.Location, "http://git.miti.sh/" assert.same request\header!.Location, "http://git.miti.sh/ccm/"
describe "http://webdevcat.me/git/", -> describe "http://webdevcat.me/git/", ->
it "permanently redirects to http://git.miti.sh", -> it "permanently redirects to http://git.miti.sh", ->
request = req "http://webdevcat.me/git" request = req "http://webdevcat.me/git"
assert.same request\header!.Location, "http://git.miti.sh/" assert.same request\header!.Location, "http://git.miti.sh/ccm/"
describe "http://webdevcat.me/git/pandoc/", -> describe "http://webdevcat.me/git/pandoc", ->
pending "permanently redirects to http://git.miti.sh/ccm/pandoc" it "permanently redirects to http://git.miti.sh/ccm/pandoc", ->
request = req "http://webdevcat.me/git/pandoc"
assert.same request\header!.Location, "http://git.miti.sh/ccm/pandoc"
describe "http://webdevcat.me/apps/btroops", ->
it "permanently redirects to http://apps.miti.sh/btroops", ->
request = req "http://webdevcat.me/apps/btroops"
assert.same request\header!.Location, "http://apps.miti.sh/btroops"
describe "http://miti.sh", -> describe "http://miti.sh", ->
it "sends /index.html", -> it "sends /index.html", ->