fix: resolve translation routing bugs for MDX pages/posts, fix QA smoke tests, and automate target host network cleanup
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Successful in 56s
Build & Deploy / 🏗️ Build (push) Successful in 2m18s
Build & Deploy / 🚀 Deploy (push) Successful in 15s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 8s
Build & Deploy / 🧪 QA (push) Successful in 56s
Build & Deploy / 🏗️ Build (push) Successful in 2m18s
Build & Deploy / 🚀 Deploy (push) Successful in 15s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
This commit is contained in:
50
tests/pages.test.ts
Normal file
50
tests/pages.test.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { getPageBySlug } from '../lib/pages';
|
||||
import { getPostBySlug, getPostSlugs } from '../lib/blog';
|
||||
|
||||
describe('getPageBySlug translation routing', () => {
|
||||
it('should resolve standard page in German', async () => {
|
||||
const page = await getPageBySlug('impressum', 'de');
|
||||
expect(page).not.toBeNull();
|
||||
expect(page?.frontmatter.title).toBe('Impressum');
|
||||
});
|
||||
|
||||
it('should resolve translated slug "legal-notice" for English', async () => {
|
||||
const page = await getPageBySlug('legal-notice', 'en');
|
||||
expect(page).not.toBeNull();
|
||||
expect(page?.frontmatter.title).toBe('Impressum');
|
||||
});
|
||||
|
||||
it('should resolve translated slug "privacy-policy" for English', async () => {
|
||||
const page = await getPageBySlug('privacy-policy', 'en');
|
||||
expect(page).not.toBeNull();
|
||||
expect(page?.frontmatter.title).toBe('Datenschutzerklärung');
|
||||
});
|
||||
|
||||
it('should return null for non-existent slugs', async () => {
|
||||
const page = await getPageBySlug('does-not-exist', 'de');
|
||||
expect(page).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('getPostBySlug and getPostSlugs translation routing', () => {
|
||||
it('should resolve post by English slug', async () => {
|
||||
const post = await getPostBySlug(
|
||||
'focus-on-wind-farm-construction-three-typical-cable-challenges',
|
||||
'en',
|
||||
);
|
||||
expect(post).not.toBeNull();
|
||||
expect(post?.frontmatter.title).toBe(
|
||||
'Windparkbau im Fokus: drei typische Kabelherausforderungen',
|
||||
);
|
||||
});
|
||||
|
||||
it('should return correct localized post slugs', async () => {
|
||||
const slugs = await getPostSlugs(
|
||||
'focus-on-wind-farm-construction-three-typical-cable-challenges',
|
||||
'en',
|
||||
);
|
||||
expect(slugs.de).toBe('windparkbau-im-fokus-drei-typische-kabelherausforderungen');
|
||||
expect(slugs.en).toBe('focus-on-wind-farm-construction-three-typical-cable-challenges');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user