diff --git a/tests/server.test.ts b/tests/server.test.ts index 1e66834..007ca66 100644 --- a/tests/server.test.ts +++ b/tests/server.test.ts @@ -42,6 +42,13 @@ test("Express app", async (done) => { it("subpath html is served correctly"); + response = await request(app).get("/nopath/"); + expect(response.status).toBe(404); + response = await request(app).get("/nopath/route"); + expect(response.status).toBe(404); + + it("no existing indexes response with 404"); + response = await request(app).get("/test.txt"); expect(response.text).toBe("Hello from test.txt"); @@ -103,6 +110,13 @@ test("Express app with explicit static middleware", async (done) => { expect(response.headers.before).toBe("1"); expect(response.headers.after).toBe("1"); + response = await request(app).get("/nopath/"); + expect(response.status).toBe(404); + response = await request(app).get("/nopath/route"); + expect(response.status).toBe(404); + + it("no existing indexes response with 404"); + response = await request(app).get("/test.txt"); expect(response.text).toBe("Hello from test.txt"); @@ -157,6 +171,13 @@ test("Express app with custom http server", async (done) => { it("subpath html is served correctly"); + response = await request(app).get("/nopath/"); + expect(response.status).toBe(404); + response = await request(app).get("/nopath/route"); + expect(response.status).toBe(404); + + it("no existing indexes response with 404"); + response = await request(app).get("/test.txt"); expect(response.text).toBe("Hello from test.txt"); @@ -241,6 +262,13 @@ test("Express app with transformer function", async (done) => { it("subpath html is transformed correctly"); + response = await request(app).get("/nopath/"); + expect(response.status).toBe(404); + response = await request(app).get("/nopath/route"); + expect(response.status).toBe(404); + + it("no existing indexes response with 404"); + response = await request(app).get("/test.txt"); expect(response.text).toBe("Hello from test.txt"); @@ -275,6 +303,13 @@ test("Express app with ignored paths", async (done) => { it("subpath html is served correctly"); + response = await request(app).get("/nopath/"); + expect(response.status).toBe(404); + response = await request(app).get("/nopath/route"); + expect(response.status).toBe(404); + + it("no existing indexes response with 404"); + response = await request(app).get("/ignored"); expect(response.text).toMatch(/Cannot GET \/ignored/);