import '@testing-library/jest-dom'; import { GET } from '@/app/sitemap.xml/route'; import { mockFetch } from '@/app/__tests__/__mocks__/mock-fetch-sitemap'; jest.mock('next/server', () => ({ NextResponse: jest.fn().mockImplementation((body, init) => ({ body, init })), })); describe('Sitemap Component', () => { beforeAll(() => { process.env.NEXT_PUBLIC_BASE_URL = 'https://dki.one'; global.fetch = mockFetch(` https://dki.one/ https://dki.one/legal-notice https://dki.one/privacy-policy https://dki.one/projects/just-doing-some-testing https://dki.one/projects/blockchain-based-voting-system `); }); it('should render the sitemap XML', async () => { const response = await GET(); expect(response.body).toContain(''); expect(response.body).toContain('https://dki.one/'); expect(response.body).toContain('https://dki.one/legal-notice'); expect(response.body).toContain('https://dki.one/privacy-policy'); expect(response.body).toContain('https://dki.one/projects/just-doing-some-testing'); expect(response.body).toContain('https://dki.one/projects/blockchain-based-voting-system'); // Note: Headers are not available in test environment }); });