import { render, screen } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { Footer } from '../Footer';
import { creditosFotos } from '@/lib/content';
describe('', () => {
it('renders the tagline and the legal line', () => {
render();
expect(screen.getByText('CLARIDAD · DIRECCIÓN · CRECIMIENTO')).toBeInTheDocument();
expect(screen.getByText(/© 2026 creeer/)).toBeInTheDocument();
});
it('does not introduce a second h1', () => {
render();
expect(screen.queryByRole('heading', { level: 1 })).toBeNull();
});
it('credits every reused photograph, with author, licence and modification notice', () => {
render();
// The licences these photographs carry require three things: naming the
// author, linking the licence, and saying the image was modified. This is
// the only place in the project where that obligation is enforced, so it
// counts against `creditosFotos` itself rather than a number typed here —
// adding a photograph without crediting it has to fail, and a hard-coded
// count only fails once someone remembers to update it.
for (const credito of creditosFotos) {
expect(credito.desc).toMatch(/—\s*\S/); // the author, after the em dash
expect(screen.getByText(credito.desc)).toHaveAttribute('href', credito.href);
expect(screen.getAllByText(credito.licencia).length).toBeGreaterThan(0);
}
expect(screen.getAllByText(/modificada/)).toHaveLength(creditosFotos.length);
});
});