Skip to content

Commit

Permalink
test: add comma cases
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Oct 7, 2024
1 parent 2c999c5 commit 4d297d1
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
12 changes: 6 additions & 6 deletions tests/e2e/on-demand-app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ test.describe('app router on-demand revalidation', () => {
{
label: 'revalidatePath (prerendered page with dynamic path) - non-ASCII variant',
prerendered: true,
pagePath: '/product/事前レンダリング',
revalidateApiPath: `/api/on-demand-revalidate/path?path=/product/事前レンダリング`,
expectedH1Content: 'Product 事前レンダリング',
pagePath: '/product/事前レンダリング,test',
revalidateApiPath: `/api/on-demand-revalidate/path?path=/product/事前レンダリング,test`,
expectedH1Content: 'Product 事前レンダリング,test',
},
{
label: 'revalidatePath (not prerendered page with dynamic path) - non-ASCII variant',
prerendered: false,
pagePath: '/product/事前レンダリングされていない',
revalidateApiPath: `/api/on-demand-revalidate/path?path=/product/事前レンダリングされていない`,
expectedH1Content: 'Product 事前レンダリングされていない',
pagePath: '/product/事前レンダリングされていない,test',
revalidateApiPath: `/api/on-demand-revalidate/path?path=/product/事前レンダリングされていない,test`,
expectedH1Content: 'Product 事前レンダリングされていない,test',
},
]) {
test(label, async ({ page, pollUntilHeadersMatch, serverComponents }) => {
Expand Down
16 changes: 8 additions & 8 deletions tests/e2e/page-router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ test.describe('Simple Page Router (no basePath, no i18n)', () => {
label:
'prerendered page with dynamic path and awaited res.revalidate() - non-ASCII variant',
prerendered: true,
pagePath: '/products/事前レンダリング',
pagePath: '/products/事前レンダリング,test',
revalidateApiBasePath: '/api/revalidate',
expectedH1Content: 'Product 事前レンダリング',
expectedH1Content: 'Product 事前レンダリング,test',
},
{
label:
'not prerendered page with dynamic path and awaited res.revalidate() - non-ASCII variant',
prerendered: false,
pagePath: '/products/事前レンダリングされていない',
pagePath: '/products/事前レンダリングされていない,test',
revalidateApiBasePath: '/api/revalidate',
expectedH1Content: 'Product 事前レンダリングされていない',
expectedH1Content: 'Product 事前レンダリングされていない,test',
},
]) {
test(label, async ({ page, pollUntilHeadersMatch, pageRouter }) => {
Expand Down Expand Up @@ -479,17 +479,17 @@ test.describe('Page Router with basePath and i18n', () => {
label:
'prerendered page with dynamic path and awaited res.revalidate() - non-ASCII variant',
prerendered: true,
pagePath: '/products/事前レンダリング',
pagePath: '/products/事前レンダリング,test',
revalidateApiBasePath: '/api/revalidate',
expectedH1Content: 'Product 事前レンダリング',
expectedH1Content: 'Product 事前レンダリング,test',
},
{
label:
'not prerendered page with dynamic path and awaited res.revalidate() - non-ASCII variant',
prerendered: false,
pagePath: '/products/事前レンダリングされていない',
pagePath: '/products/事前レンダリングされていない,test',
revalidateApiBasePath: '/api/revalidate',
expectedH1Content: 'Product 事前レンダリングされていない',
expectedH1Content: 'Product 事前レンダリングされていない,test',
},
]) {
test.describe(label, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export const getStaticPaths = ({ locales }) => {
},
{
params: {
// Japanese prerendered (non-ascii)
slug: '事前レンダリング',
// Japanese prerendered (non-ascii) and comma
slug: '事前レンダリング,test',
},
},
].flatMap((pathDescription) => locales.map((locale) => ({ ...pathDescription, locale }))),
Expand Down
4 changes: 2 additions & 2 deletions tests/fixtures/page-router/pages/products/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ export const getStaticPaths = () => {
},
{
params: {
// Japanese prerendered (non-ascii)
slug: '事前レンダリング',
// Japanese prerendered (non-ascii) and comma
slug: '事前レンダリング,test',
},
},
],
Expand Down
6 changes: 3 additions & 3 deletions tests/fixtures/server-components/app/product/[slug]/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Product = ({ params }) => (
<div>
<h1>Product {decodeURI(params.slug)}</h1>
<h1>Product {decodeURIComponent(params.slug)}</h1>
<p>
This page uses generateStaticParams() to prerender a Product
<span data-testid="date-now">{new Date().toISOString()}</span>
Expand All @@ -11,8 +11,8 @@ const Product = ({ params }) => (
export async function generateStaticParams() {
return [
{
// Japanese prerendered (non-ascii)
slug: '事前レンダリング',
// Japanese prerendered (non-ascii) and comma
slug: '事前レンダリング,test',
},
]
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/cache-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('page router', () => {
// the real key is much longer and ends in a hash, but we only assert on the first 50 chars to make it easier
'/products/an-incredibly-long-product-',
'/products/prerendered',
'/products/事前レンダリング',
'/products/事前レンダリング,test',
'/static/revalidate-automatic',
'/static/revalidate-manual',
'/static/revalidate-slow',
Expand Down Expand Up @@ -360,7 +360,7 @@ describe('plugin', () => {
'/api/static/first',
'/api/static/second',
'/index',
'/product/事前レンダリング',
'/product/事前レンダリング,test',
'/revalidate-fetch',
'/static-fetch-1',
'/static-fetch-2',
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/static.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ test<FixtureTestContext>('requesting a non existing page route that needs to be
expect(entries.map(({ key }) => decodeBlobKey(key.substring(0, 50))).sort()).toEqual([
'/products/an-incredibly-long-product-',
'/products/prerendered',
'/products/事前レンダリング',
'/products/事前レンダリング,test',
'/static/revalidate-automatic',
'/static/revalidate-manual',
'/static/revalidate-slow',
Expand Down

0 comments on commit 4d297d1

Please sign in to comment.