miti.sh/spec/routes_spec.moon
Catalin Mititiuc 831a86c738 Don't publish any ports from the test container
This allows us to make test requests to port 80, like in production
2025-06-11 09:44:38 -07:00

51 lines
1.8 KiB
Plaintext

http = require "luajit-curl-helper.http"
index_title = "miti.sh · Catalin Constantin Mititiuc"
req = (url) ->
request = http.init url
st = request\perform!
error request\lastError! if not st
request
describe "http://webdevcat.me", ->
it "permanently redirects to http://miti.sh", ->
request = req "http://webdevcat.me"
assert.same request\statusCode!, 301
assert.same request\statusMessage!, "Moved Permanently"
assert.same request\header!.Location, "http://miti.sh/"
describe "http://webdevcat.me/git", ->
it "permanently redirects to http://git.miti.sh", ->
request = req "http://webdevcat.me/git"
assert.same request\header!.Location, "http://git.miti.sh/"
describe "http://webdevcat.me/git/", ->
it "permanently redirects to http://git.miti.sh", ->
request = req "http://webdevcat.me/git"
assert.same request\header!.Location, "http://git.miti.sh/"
describe "http://webdevcat.me/git/pandoc/", ->
pending "permanently redirects to http://git.miti.sh/ccm/pandoc"
describe "http://miti.sh", ->
it "sends /index.html", ->
request = req "http://miti.sh"
assert.same request\statusCode!, 200
assert.same request\statusMessage!, "OK"
assert.same request\body!\match("<title>(.*)</title>"), index_title
describe "http://miti.sh/index", ->
it "sends /index.html", ->
request = req "http://miti.sh/index"
assert.same request\statusCode!, 200
assert.same request\statusMessage!, "OK"
assert.same request\body!\match("<title>(.*)</title>"), index_title
describe "http://miti.sh/index.html", ->
it "sends /index.html", ->
request = req "http://miti.sh/index.html"
assert.same request\statusCode!, 200
assert.same request\statusMessage!, "OK"
assert.same request\body!\match("<title>(.*)</title>"), index_title