16 lines
546 B
TypeScript
16 lines
546 B
TypeScript
import { expect, test } from "@playwright/test";
|
||
|
||
test("未知路径返回 404 页面", async ({ page }) => {
|
||
const res = await page.goto("/zh-CN/definitely-not-a-page");
|
||
expect(res?.status()).toBe(404);
|
||
});
|
||
|
||
test("裸非法路径视为非法 locale 前缀,302 到本地化首页", async ({ request }) => {
|
||
const res = await request.get("/no-such-page", {
|
||
headers: { "accept-language": "zh-CN" },
|
||
maxRedirects: 0,
|
||
});
|
||
expect(res.status()).toBe(302);
|
||
expect(res.headers()["location"]).toBe("/zh-CN");
|
||
});
|