import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
import { render, screen } from '@testing-library/react'
import Footer from '@/components/layout/Footer'

beforeEach(() => {
  vi.useFakeTimers()
  vi.setSystemTime(new Date('2026-05-31'))
})

afterEach(() => {
  vi.useRealTimers()
})

describe('Footer', () => {
  it('renders the site logo', () => {
    render(<Footer />)
    expect(screen.getByText('言羽')).toBeInTheDocument()
  })

  it('renders the tagline', () => {
    render(<Footer />)
    expect(
      screen.getByText(/Japanese pop-culture news/)
    ).toBeInTheDocument()
  })

  it('renders the current year in copyright', () => {
    render(<Footer />)
    expect(screen.getByText(/2026 Kotobane/)).toBeInTheDocument()
  })

  it('renders a footer element with border class', () => {
    const { container } = render(<Footer />)
    const footer = container.querySelector('footer')
    expect(footer).toHaveClass('border-t')
  })
})
