Skip to content

Commit a764e08

Browse files
committed
mv
1 parent 4556879 commit a764e08

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed
Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
import { expect, test } from "@playwright/test";
2-
import { validateMd5 } from "../../utils";
3-
4-
/*
5-
* `curl -s https://opennext.js.org/share.png | md5sum`
6-
* This is the MD5 hash of the image. It is used to validate the image content.
7-
*/
8-
const OPENNEXT_PNG_MD5 = "405f45cc3397b09717a13ebd6f1e027b";
92

103
test("Middleware Redirect", async ({ page, context }) => {
114
await page.goto("/");
@@ -25,23 +18,3 @@ test("Middleware Redirect", async ({ page, context }) => {
2518
el = page.getByText("Redirect Destination", { exact: true });
2619
await expect(el).toBeVisible();
2720
});
28-
29-
test("Middleware Rewrite External Image", async ({ page }) => {
30-
await page.goto("/rewrite-external");
31-
page.on("response", async (response) => {
32-
expect(response.status()).toBe(200);
33-
expect(response.headers()["content-type"]).toBe("image/png");
34-
expect(response.headers()["cache-control"]).toBe("max-age=600");
35-
const bodyBuffer = await response.body();
36-
expect(validateMd5(bodyBuffer, OPENNEXT_PNG_MD5)).toBe(true);
37-
});
38-
});
39-
40-
test("Middleware Rewrite Status Code", async ({ page }) => {
41-
await page.goto("/rewrite-status-code");
42-
const el = page.getByText("Rewritten Destination", { exact: true });
43-
await expect(el).toBeVisible();
44-
page.on("response", async (response) => {
45-
expect(response.status()).toBe(403);
46-
});
47-
});

examples/e2e/app-router/e2e/middleware.rewrite.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
import { expect, test } from "@playwright/test";
2+
import { validateMd5 } from "../../utils";
3+
4+
/*
5+
* `curl -s https://opennext.js.org/share.png | md5sum`
6+
* This is the MD5 hash of the image. It is used to validate the image content.
7+
*/
8+
const OPENNEXT_PNG_MD5 = "405f45cc3397b09717a13ebd6f1e027b";
29

310
test("Middleware Rewrite", async ({ page }) => {
411
await page.goto("/");
@@ -14,3 +21,23 @@ test("Middleware Rewrite", async ({ page }) => {
1421
el = page.getByText("Rewritten Destination", { exact: true });
1522
await expect(el).toBeVisible();
1623
});
24+
25+
test("Middleware Rewrite External Image", async ({ page }) => {
26+
await page.goto("/rewrite-external");
27+
page.on("response", async (response) => {
28+
expect(response.status()).toBe(200);
29+
expect(response.headers()["content-type"]).toBe("image/png");
30+
expect(response.headers()["cache-control"]).toBe("max-age=600");
31+
const bodyBuffer = await response.body();
32+
expect(validateMd5(bodyBuffer, OPENNEXT_PNG_MD5)).toBe(true);
33+
});
34+
});
35+
36+
test("Middleware Rewrite Status Code", async ({ page }) => {
37+
await page.goto("/rewrite-status-code");
38+
const el = page.getByText("Rewritten Destination", { exact: true });
39+
await expect(el).toBeVisible();
40+
page.on("response", async (response) => {
41+
expect(response.status()).toBe(403);
42+
});
43+
});

0 commit comments

Comments
 (0)