Add a test for issue #60

This commit is contained in:
Daan Sprenkels
2020-05-30 17:49:44 +02:00
parent 847fd8072b
commit 0b2297a2e8
2 changed files with 22 additions and 6 deletions

View File

@@ -57,7 +57,7 @@ func createTemporaryRouter(t *testing.T) (*mux.Router, *rushlink) {
fs: fileStore,
rootURL: rootURL,
}
return CreateMainRouter(&rl), &rl
return CreateMainRouter(&rl, true), &rl
}
// checkStatusCode checks whether the status code from a recorded response is equal
@@ -145,5 +145,17 @@ func TestIssue53(t *testing.T) {
}
return nil
})
}
func TestIssue60(t *testing.T) {
srv, _ := createTemporaryRouter(t)
// Put a URL with a fragment identifier into the database.
req, err := http.NewRequest("GET", "/css/nonexistent_file.css", nil)
if err != nil {
t.Fatal(err)
}
rr := httptest.NewRecorder()
srv.ServeHTTP(rr, req)
checkStatusCode(t, rr, http.StatusNotFound)
}