feat: migrate Payload CMS to MDX and harden static infrastructure
This commit is contained in:
46
tests/translation-links.test.ts
Normal file
46
tests/translation-links.test.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
const DE_JSON = JSON.parse(
|
||||
fs.readFileSync(path.resolve(__dirname, '../messages/de.json'), 'utf-8'),
|
||||
);
|
||||
const EN_JSON = JSON.parse(
|
||||
fs.readFileSync(path.resolve(__dirname, '../messages/en.json'), 'utf-8'),
|
||||
);
|
||||
|
||||
describe('Translation Link Parity', () => {
|
||||
it('should ensure the German termsSlug points to an existing MDX page', () => {
|
||||
const slug = DE_JSON.Footer.termsSlug;
|
||||
expect(slug).toBeTruthy();
|
||||
|
||||
const pagePath = path.resolve(__dirname, `../content/pages/${slug}.mdx`);
|
||||
const exists = fs.existsSync(pagePath);
|
||||
|
||||
expect(exists).toBe(true);
|
||||
});
|
||||
|
||||
it('should ensure the English termsSlug points to an existing MDX page', () => {
|
||||
const slug = EN_JSON.Footer.termsSlug;
|
||||
expect(slug).toBeTruthy();
|
||||
|
||||
const pagePath = path.resolve(__dirname, `../content/pages/${slug}.mdx`);
|
||||
const exists = fs.existsSync(pagePath);
|
||||
|
||||
expect(exists).toBe(true);
|
||||
});
|
||||
|
||||
it('should ensure privacyPolicySlug points to an existing MDX page for DE', () => {
|
||||
const slug = DE_JSON.Footer.privacyPolicySlug;
|
||||
expect(slug).toBeTruthy();
|
||||
const pagePath = path.resolve(__dirname, `../content/pages/${slug}.mdx`);
|
||||
expect(fs.existsSync(pagePath)).toBe(true);
|
||||
});
|
||||
|
||||
it('should ensure privacyPolicySlug points to an existing MDX page for EN', () => {
|
||||
const slug = EN_JSON.Footer.privacyPolicySlug;
|
||||
expect(slug).toBeTruthy();
|
||||
const pagePath = path.resolve(__dirname, `../content/pages/${slug}.mdx`);
|
||||
expect(fs.existsSync(pagePath)).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user