Files
e-tib.com/tests/task-12-links.test.ts
Marc Mintel 233509db67
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 43s
Build & Deploy / 🧪 QA (push) Failing after 1m5s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
fix(links): update all maps and tiles to use standorte pages as single source of truth
2026-06-14 21:40:48 +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/standorte/kirchheilingen"
expect(deContent).toMatch(/title:\s*"E-TIB Bohrtechnik GmbH"[\s\S]*?url:\s*["']\/de\/standorte\/kirchheilingen["']/);
// Assert that E-TIB Bohrtechnik GmbH has url: "/en/standorte/kirchheilingen" 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\/standorte\/kirchheilingen["']/);
});
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();
});
});
});