Files
e-tib.com/tests/task-12-links.test.ts
Marc Mintel 3bb6eb3447
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Successful in 1m5s
Build & Deploy / 🏗️ Build (push) Successful in 2m11s
Build & Deploy / 🚀 Deploy (push) Successful in 33s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 42s
Build & Deploy / 🔔 Notify (push) Successful in 1s
fix: revert bohrtechnik to competence link, remove kirchheilingen location
2026-06-14 22:46:16 +02:00

39 lines
1.9 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import fs from 'fs';
import path from 'path';
import { defaultLocations } from '../lib/map-data';
describe('Task 12 TDD - Bohrtechnik and Reference Links', () => {
const deHomePath = path.join(process.cwd(), 'content', 'de', 'home.mdx');
const enHomePath = path.join(process.cwd(), 'content', 'en', 'home.mdx');
it('should verify E-TIB Bohrtechnik GmbH has the correct page link in DE and EN home.mdx', () => {
const deContent = fs.readFileSync(deHomePath, 'utf8');
const enContent = fs.readFileSync(enHomePath, 'utf8');
// Assert that E-TIB Bohrtechnik GmbH has url: "/de/bohrtechnik" in German content
expect(deContent).toContain('title: "E-TIB Bohrtechnik GmbH"');
// We expect it to have the url parameter added
const bohrtechnikDeBlock = deContent.substring(deContent.indexOf('title: "E-TIB Bohrtechnik GmbH"'));
const urlDeIndex = bohrtechnikDeBlock.indexOf('url:');
const nextItemDeIndex = bohrtechnikDeBlock.indexOf('title:', 10);
// Ensure "url:" exists within the E-TIB Bohrtechnik block and points to "/de/bohrtechnik"
expect(deContent).toMatch(/title:\s*"E-TIB Bohrtechnik GmbH"[\s\S]*?url:\s*["']\/de\/bohrtechnik["']/);
// Assert that E-TIB Bohrtechnik GmbH has url: "/en/drilling-technology" in English content
expect(enContent).toContain('title: "E-TIB Bohrtechnik GmbH"');
expect(enContent).toMatch(/title:\s*"E-TIB Bohrtechnik GmbH"[\s\S]*?url:\s*["']\/en\/drilling-technology["']/);
});
it('should verify that all reference projects in map-data have no href links', () => {
// Check that all defaultLocations of type 'project' have href undefined or removed
const projects = defaultLocations.filter(loc => loc.type === 'project');
expect(projects.length).toBeGreaterThan(0);
projects.forEach(project => {
expect(project.href).toBeUndefined();
});
});
});