Skip to content

Commit

Permalink
added e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
conico974 committed May 9, 2024
1 parent 30e42f2 commit 1ea06ba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
15 changes: 14 additions & 1 deletion examples/pages-router/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,20 @@ const nextConfig = {
reactStrictMode: true,
output: "standalone",
outputFileTracing: "../sst",
rewrites: () => [{ source: "/rewrite", destination: "/" }],
rewrites: () => [
{ source: "/rewrite", destination: "/" },
{
source: "/rewriteUsingQuery",
destination: "/:destination/",
has: [
{
type: "query",
key: "d",
value: "(?<destination>\\w+)",
},
],
},
],
trailingSlash: true,
};

Expand Down
7 changes: 7 additions & 0 deletions packages/tests-e2e/tests/pagesRouter/rewrite.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ test("Single Rewrite", async ({ page }) => {
let el = page.getByText("Nextjs Pages Router");
await expect(el).toBeVisible();
});

test("Rewrite with query", async ({ page }) => {
await page.goto("/rewriteUsingQuery?d=ssr");

let el = page.getByText("SSR");
await expect(el).toBeVisible();
});

0 comments on commit 1ea06ba

Please sign in to comment.