import { render, screen } from '@testing-library/svelte';
import { describe, expect, it } from 'vitest';
import { homepageContent } from '$lib/content/homepage';
import HomePage from './+page.svelte';
import { createHomepageRouteData } from '../test/fixtures';

describe('home page route', () => {
  it('renders the homepage sections and SEO metadata', () => {
    render(HomePage, {
      data: createHomepageRouteData()
    });

    expect(screen.getByText(homepageContent.hero.highlight)).toBeInTheDocument();
    expect(screen.getByText(homepageContent.howItWorks.title)).toBeInTheDocument();
    expect(screen.getByText(homepageContent.info.title)).toBeInTheDocument();
    expect(screen.queryByLabelText(/General enquiry/i)).not.toBeInTheDocument();
    expect(document.title).toBe(homepageContent.seo.title);
    expect(document.head.innerHTML).toContain('FAQPage');
    expect(document.head.innerHTML).toContain('https://www.goodwalk.co.nz/images/auckland-dog-walking-happy-dog-hero.png');
  });
});
