migrate to nextjs

This commit is contained in:
2026-01-29 00:14:30 +01:00
parent 081dad7cf9
commit 0853a497ef
34 changed files with 4879 additions and 5956 deletions

25
tests/home.test.tsx Normal file
View File

@@ -0,0 +1,25 @@
import { render, screen } from '@testing-library/react'
import { describe, it, expect } from 'vitest'
import Home from '../app/page'
describe('Home Page', () => {
it('renders the hero section with correct title', () => {
render(<Home />)
expect(screen.getByText(/Spezialisierter Partner für Energiekabelprojekte/i)).toBeInTheDocument()
})
it('contains the CTA button', () => {
render(<Home />)
const ctaButton = screen.getByRole('link', { name: /Projekt anfragen/i })
expect(ctaButton).toBeInTheDocument()
expect(ctaButton).toHaveAttribute('href', '/kontakt')
})
it('renders the portfolio section', () => {
render(<Home />)
expect(screen.getByText(/Unsere Leistungen/i)).toBeInTheDocument()
// Use getAllByText because it appears in both hero description and card title
const elements = screen.getAllByText(/Technische Beratung/i)
expect(elements.length).toBeGreaterThan(0)
})
})

12
tests/setup.ts Normal file
View File

@@ -0,0 +1,12 @@
import '@testing-library/jest-dom'
import { vi } from 'vitest'
// Mock next/navigation
vi.mock('next/navigation', () => ({
usePathname: () => '/',
useRouter: () => ({
push: vi.fn(),
replace: vi.fn(),
prefetch: vi.fn(),
}),
}))