import { render, screen } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { Cierre } from '../Cierre';
describe('', () => {
it('renders the closing quote', () => {
render();
expect(screen.getByText(/Devuélvele claridad/i)).toBeInTheDocument();
});
it('renders 3 contact links with correct hrefs', () => {
render();
const wa = screen.getByRole('link', { name: /whatsapp/i });
const mail = screen.getByRole('link', { name: /email/i });
const li = screen.getByRole('link', { name: /linkedin/i });
expect(wa.getAttribute('href')).toMatch(/^https:\/\/wa\.me\//);
expect(mail.getAttribute('href')).toMatch(/^mailto:/);
expect(li.getAttribute('href')).toMatch(/^https:\/\/(www\.)?linkedin\./);
});
it('wraps contact links in a nav with aria-label="Contacto"', () => {
render();
expect(screen.getByRole('navigation', { name: /contacto/i })).toBeInTheDocument();
});
});
describe(' — pestañas', () => {
it('opens WhatsApp and LinkedIn in a new tab and keeps email in place', () => {
render();
for (const nombre of [/whatsapp/i, /linkedin/i]) {
for (const a of screen.getAllByRole('link', { name: nombre })) {
expect(a).toHaveAttribute('target', '_blank');
expect(a).toHaveAttribute('rel', 'noopener noreferrer');
}
}
expect(screen.getByRole('link', { name: /email/i })).not.toHaveAttribute('target');
});
});