feat(task-12): link Bohrtechnik to service pages and remove reference detailed links
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 36s
Build & Deploy / 🧪 QA (push) Successful in 2m7s
CI - Lint, Typecheck & Test / quality-assurance (pull_request) Successful in 3m31s
Build & Deploy / 🏗️ Build (push) Successful in 3m45s
Build & Deploy / 🚀 Deploy (push) Successful in 33s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 4s
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 36s
Build & Deploy / 🧪 QA (push) Successful in 2m7s
CI - Lint, Typecheck & Test / quality-assurance (pull_request) Successful in 3m31s
Build & Deploy / 🏗️ Build (push) Successful in 3m45s
Build & Deploy / 🚀 Deploy (push) Successful in 33s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 4s
This commit is contained in:
38
tests/task-12-links.test.ts
Normal file
38
tests/task-12-links.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
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();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user