Files
klz-cables.com/tests/translation-links.test.ts

47 lines
1.6 KiB
TypeScript

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);
});
});