Files
Creeer-Web/components/sections/__tests__/Hero.test.tsx
T
erikghandClaude Opus 5 3d3d5b2f9a test(hero): la prueba de la metáfora ya no pasa con cualquier svg
Sólo comprobaba que hubiera algún svg, así que seguía en verde aunque
SecuenciaClaridad desapareciera del hero: los campos de puntos bastaban.

Ahora exige las líneas de la secuencia (18, y ninguna viene de otra
parte — FondoPuntos dibuja círculos) y que ninguna lleve data-resolucion:
el hero plantea la tensión, resolverla es cosa de FraseAncla.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 16:03:22 -06:00

46 lines
2.2 KiB
TypeScript

import { render, screen } from '@testing-library/react';
import { describe, it, expect } from 'vitest';
import { Hero } from '../Hero';
describe('<Hero />', () => {
it('renders the eyebrow', () => {
render(<Hero variant="editorial" />);
expect(screen.getByText(/tu estratega de crecimiento/i)).toBeInTheDocument();
});
it('renders the headline copy', () => {
const { container } = render(<Hero variant="hormozi" />);
expect(container.textContent).toMatch(/Tu negocio/i);
expect(container.textContent).toMatch(/más esfuerzo/i);
expect(container.textContent).toMatch(/más claridad/i);
});
it('renders the CTA', () => {
render(<Hero variant="editorial" />);
expect(screen.getByRole('link', { name: /define tu siguiente movimiento/i })).toHaveAttribute('href', '#contacto');
});
it('offers a secondary route into the process for readers not ready to convert', () => {
render(<Hero variant="editorial" />);
expect(screen.getByRole('link', { name: /ver cómo trabajo/i })).toHaveAttribute('href', '#mecanismo');
});
it('does NOT render scarcity (cupos/cohorte)', () => {
const { container } = render(<Hero variant="editorial" />);
expect(container.textContent).not.toMatch(/cupos|cohorte|generación fundadora/i);
});
it('does not pre-empt the Dolores section with its own copy', () => {
const { container } = render(<Hero variant="editorial" />);
// The hero used to rotate the same four quotes that Dolores renders in
// full further down. Duplicating them spent the emotional beat early and
// competed with the headline.
expect(container.textContent).not.toMatch(/Trabajo más y gano casi lo mismo/i);
});
it('poses the brand metaphor without resolving it', () => {
const { container } = render(<Hero variant="editorial" />);
// SecuenciaClaridad is the only thing here drawn from <line>; the dot
// fields are circles. variant="hero" plays dispersion and convergence
// only — the ≡ resolution is FraseAncla's payoff, and a hero that
// resolved would spend the beat before the copy earns it.
expect(container.querySelectorAll('line').length).toBeGreaterThan(10);
expect(container.querySelectorAll('[data-resolucion]')).toHaveLength(0);
});
});