From 349eb14969f1412488547a30fbd789f51547ad1f Mon Sep 17 00:00:00 2001
From: crystal <crystal@noreply.codeberg.org>
Date: Sat, 11 Jun 2022 16:45:10 -0600
Subject: [PATCH] integration test for custom 404 pages

---
 integration/get_test.go | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/integration/get_test.go b/integration/get_test.go
index 3f2048e..7843fbe 100644
--- a/integration/get_test.go
+++ b/integration/get_test.go
@@ -49,6 +49,19 @@ func TestGetContent(t *testing.T) {
 	assert.True(t, getSize(resp.Body) > 1000)
 }
 
+func TestGetNotFound(t *testing.T) {
+	log.Printf("== TestGetNotFound ==\n")
+	// test custom not found pages
+	resp, err := getTestHTTPSClient().Get("https://crystal.localhost.mock.directory:4430/pages-404-demo/blah")
+	assert.NoError(t, err)
+	if !assert.EqualValues(t, http.StatusNotFound, resp.StatusCode) {
+		t.FailNow()
+        }
+	assert.EqualValues(t, "text/html; charset=utf-8", resp.Header["Content-Type"][0])
+	assert.EqualValues(t, "37", resp.Header["Content-Length"][0])
+	assert.EqualValues(t, 37, getSize(resp.Body))
+}
+
 func getTestHTTPSClient() *http.Client {
 	cookieJar, _ := cookiejar.New(nil)
 	return &http.Client{