Add tests for i18n metadata utilities and improve locale-based metadata generation
- Introduced comprehensive unit tests for `generateLocalizedMetadata` and `generatePageMetadata` utilities. - Enhanced `siteConfig` validation assertions for structure and localization support. - Updated metadata generation to handle empty paths, canonical URLs, language alternates, and Open Graph data consistently. - Annotated server-side middleware with istanbul ignore for coverage clarity.
This commit is contained in:
@@ -62,9 +62,9 @@ export async function generateLocalizedMetadata(
|
||||
alternates: {
|
||||
canonical: url,
|
||||
languages: {
|
||||
en: `/${path}`,
|
||||
it: `/it${path}`,
|
||||
'x-default': `/${path}`,
|
||||
en: path || '/',
|
||||
it: `/it${path || '/'}`,
|
||||
'x-default': path || '/',
|
||||
},
|
||||
},
|
||||
openGraph: {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
import { getRequestConfig } from 'next-intl/server';
|
||||
import { routing } from '@/lib/i18n/routing';
|
||||
|
||||
/* istanbul ignore next - Server-side middleware configuration covered by e2e tests */
|
||||
export default getRequestConfig(async ({ locale }) => {
|
||||
// Validate that the incoming `locale` parameter is valid
|
||||
// Type assertion: we know locale will be a string from the URL parameter
|
||||
|
||||
Reference in New Issue
Block a user