Skip to content

Commit 9198048

Browse files
authored
test: add 200 and 404 response checks for GET requests to "/slug/" and "/slug" paths
1 parent 6a8465e commit 9198048

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test/middleware.test.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5191,6 +5191,11 @@ describe.each([
51915191
path.resolve(outputPath, "default.html"),
51925192
"hello",
51935193
);
5194+
5195+
instance.context.outputFileSystem.writeFileSync(
5196+
path.resolve(outputPath, "slug", "default.html"),
5197+
"hello",
5198+
);
51945199
});
51955200

51965201
afterAll(async () => {
@@ -5206,6 +5211,24 @@ describe.each([
52065211
);
52075212
});
52085213

5214+
it('should return the "200" code for the "GET" request to the "/slug/" path', async () => {
5215+
const response = await req.get("/slug/");
5216+
5217+
expect(response.statusCode).toBe(200);
5218+
expect(response.headers["content-type"]).toBe(
5219+
"text/html; charset=utf-8",
5220+
);
5221+
});
5222+
5223+
it('should return the "404" code for the "GET" request to the "/slug" path', async () => {
5224+
const response = await req.get("/slug");
5225+
5226+
expect(response.statusCode).toBe(404);
5227+
expect(response.headers["content-type"]).toEqual(
5228+
get404ContentTypeHeader(name),
5229+
);
5230+
});
5231+
52095232
it('should return the "404" code for the "GET" request with a non-existent file', async () => {
52105233
const response = await req.get("/default.html/");
52115234

0 commit comments

Comments
 (0)