UNPKG

@eureca/eureca-ui

Version:

UI component library of Eureca's user and admin apps

47 lines (40 loc) 1.35 kB
import React from 'react'; import { OpportunityCard } from '../opportunity'; import { render } from '@testing-library/react'; function renderOpportunityCard({ title, subtitle, ...props }) { return render(<OpportunityCard title={title} subtitle={subtitle} {...props} />); } describe('Opportunity Card component', () => { it('has a title and subtitle in document', () => { const { getByText } = renderOpportunityCard({ title: 'Título', subtitle: 'Sub-título', status: 'rascunho', }); const titulo = getByText('Título'); const subtitulo = getByText('Sub-título'); expect(titulo.textContent).toBe('Título'); expect(subtitulo.textContent).toBe('Sub-título'); }); it('renders a category', () => { const { getByLabelText } = renderOpportunityCard({ title: 'Título', like: 33, status: 'arquivado', }); const like = getByLabelText('like'); expect(like.textContent).toBe('33'); }); it('renders more categories', () => { const { getByLabelText } = renderOpportunityCard({ title: 'Título', candidates: 45, jobs: 30, status: 'recebendo', }); const candidates = getByLabelText('candidates'); const jobs = getByLabelText('jobs'); expect(candidates.textContent).toBe('45'); expect(jobs.textContent).toBe('30'); }); });