Update homepage routes to include language and mode
Build & Deploy / Build & Push Docker Image (push) Successful in 2m51s
Test / Type Check (all packages) (push) Successful in 52s
Build & Deploy / Deploy to VPS (push) Successful in 4s
Test / API Unit Tests (push) Successful in 49s
Test / Homepage Unit Tests (push) Successful in 44s
Test / Storefront Unit Tests (push) Successful in 39s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 40s
Test / API Integration Tests (push) Successful in 1m0s
Build & Deploy / Build & Push Docker Image (push) Successful in 2m51s
Test / Type Check (all packages) (push) Successful in 52s
Build & Deploy / Deploy to VPS (push) Successful in 4s
Test / API Unit Tests (push) Successful in 49s
Test / Homepage Unit Tests (push) Successful in 44s
Test / Storefront Unit Tests (push) Successful in 39s
Test / Admin Unit Tests (push) Successful in 40s
Test / Dashboard Unit Tests (push) Successful in 40s
Test / API Integration Tests (push) Successful in 1m0s
This commit is contained in:
@@ -27,33 +27,33 @@ describe('localization foundations', () => {
|
||||
});
|
||||
|
||||
it('generates and resolves localized stable route paths', () => {
|
||||
expect(localizedPath('home', 'ar')).toBe('/ar');
|
||||
expect(localizedPath('privacy', 'fr')).toBe('/fr/confidentialite');
|
||||
expect(localizedPath('sign-in', 'ar')).toBe('/ar/تسجيل-الدخول');
|
||||
expect(localizedPath('home', 'ar')).toBe('/ar/system');
|
||||
expect(localizedPath('privacy', 'fr')).toBe('/fr/system/confidentialite');
|
||||
expect(localizedPath('sign-in', 'ar')).toBe('/ar/system/تسجيل-الدخول');
|
||||
expect(routeIdFromSlug('fr', 'confidentialite')).toBe('privacy');
|
||||
expect(routeIdFromSlug('fr', 'privacy')).toBeNull();
|
||||
expect(routeIdFromAnyLocaleSlug('privacy')).toBe('privacy');
|
||||
expect(routeIdFromAnyLocaleSlug('confidentialite')).toBe('privacy');
|
||||
expect(routeIdFromAnyLocaleSlug('unknown')).toBeNull();
|
||||
expect(routeIdFromPathname('/ar/%D8%A7%D9%84%D8%AE%D8%B5%D9%88%D8%B5%D9%8A%D8%A9')).toBe(
|
||||
'privacy',
|
||||
);
|
||||
expect(
|
||||
routeIdFromPathname('/ar/system/%D8%A7%D9%84%D8%AE%D8%B5%D9%88%D8%B5%D9%8A%D8%A9'),
|
||||
).toBe('privacy');
|
||||
expect(routeIdFromPathname('/de')).toBeNull();
|
||||
});
|
||||
|
||||
it('generates reciprocal hreflang values', () => {
|
||||
const links = hreflangMap(new URL('https://approved.test'), 'home');
|
||||
expect(links.en).toBe('https://approved.test/en');
|
||||
expect(links.ar).toBe('https://approved.test/ar');
|
||||
expect(links['x-default']).toBe('https://approved.test/en');
|
||||
expect(links.en).toBe('https://approved.test/en/system');
|
||||
expect(links.ar).toBe('https://approved.test/ar/system');
|
||||
expect(links['x-default']).toBe('https://approved.test/en/system');
|
||||
});
|
||||
|
||||
it('preserves only approved campaign query values and valid hashes', () => {
|
||||
const current = new URL(
|
||||
'https://approved.test/en?utm_source=campaign&email=private%40approved.test#gibberish',
|
||||
'https://approved.test/en/system?utm_source=campaign&email=private%40approved.test#gibberish',
|
||||
);
|
||||
const switched = localeSwitchUrl(current, 'fr', 'home');
|
||||
expect(switched.pathname).toBe('/fr');
|
||||
expect(switched.pathname).toBe('/fr/system');
|
||||
expect(switched.search).toBe('?utm_source=campaign');
|
||||
expect(switched.hash).toBe('');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user