Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/dashboard/financeiro/financeiro-client.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ describe('FinanceiroClient', () => {
it('renders "Inadimplente" badge for each student', () => {
render(<FinanceiroClient initialInadimplentes={mockInadimplentes} />);
const badges = screen.getAllByText('Inadimplente');
expect(badges.length).toBe(2);
expect(badges).toHaveLength(2);
});

it('renders "Registrar Pagamento" buttons', () => {
render(<FinanceiroClient initialInadimplentes={mockInadimplentes} />);
const buttons = screen.getAllByText('Registrar Pagamento');
expect(buttons.length).toBe(2);
expect(buttons).toHaveLength(2);
});

it('shows empty state when no inadimplentes', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/app/dashboard/treinos/__tests__/nan-guards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('NaN guard patterns', () => {

it('empty string becomes undefined with ||, not empty string', () => {
const empty = '';
expect(empty || undefined).toBe(undefined);
expect(empty || undefined).toBeUndefined();
expect(empty ?? undefined).toBe(''); // '' passes through ??
});

Expand Down
4 changes: 2 additions & 2 deletions src/components/WorkoutSession.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ describe('WorkoutSession', () => {
render(<WorkoutSession treino={mockTreino} onFinish={mockOnFinish} onCancel={mockOnCancel} />);
const pesoInputs = screen.getAllByPlaceholderText('Peso (kg)');
const repsInputs = screen.getAllByPlaceholderText('Reps');
expect(pesoInputs.length).toBe(3);
expect(repsInputs.length).toBe(3);
expect(pesoInputs).toHaveLength(3);
expect(repsInputs).toHaveLength(3);
});

it('disables "Anterior" button on first exercise', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard-nav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe('DashboardNav', () => {
const activeButtons = menuButtons.filter(
(btn) => btn.getAttribute('data-is-active') === 'true'
);
expect(activeButtons.length).toBe(1);
expect(activeButtons).toHaveLength(1);
});

it('links have correct href attributes', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/aluno/card-feedback.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('CardFeedback', () => {
render(<CardFeedback feedback={null} isLoading={true} />);
expect(screen.getByText(/Pulsando Bio-Dados/i)).toBeTruthy();
const skeletons = screen.getAllByTestId('skeleton');
expect(skeletons.length).toBe(3);
expect(skeletons).toHaveLength(3);
});

it('renders feedback title and message when provided', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/aluno/workout-editor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,6 @@ describe('WorkoutEditor', () => {
mockUseWorkoutExercises.mockReturnValue({ ...defaultHookReturn, exercicios: exercises });

render(<WorkoutEditor onSave={mockOnSave} treinoToEdit={null} onCancel={mockOnCancel} />);
expect(screen.getAllByTestId('exercise-row').length).toBe(2);
expect(screen.getAllByTestId('exercise-row')).toHaveLength(2);
});
});
2 changes: 1 addition & 1 deletion src/components/dashboard/alunos/columns.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ describe('columns', () => {

it('returns an array of column definitions', () => {
expect(Array.isArray(columnDefs)).toBe(true);
expect(columnDefs.length).toBe(6);
expect(columnDefs).toHaveLength(6);
});

it('has photo column with accessorKey fotoUrl', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/circular-progress.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('CircularProgress', () => {
it('renders SVG circles', () => {
const { container } = render(<CircularProgress value={75} />);
const circles = container.querySelectorAll('circle');
expect(circles.length).toBe(2);
expect(circles).toHaveLength(2);
});

it('displays value when showValue is true', () => {
Expand Down
16 changes: 8 additions & 8 deletions src/lib/exercise-options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import { EXERCICIOS_POR_GRUPO } from './constants';
describe('exerciciosOptions', () => {
it('is a non-empty array', () => {
expect(Array.isArray(exerciciosOptions)).toBe(true);
expect(exerciciosOptions.length).toBeGreaterThan(0);
expect(exerciciosOptions.length).toBeGreaterThanOrEqual(1);
});

it('has the same number of groups as EXERCICIOS_POR_GRUPO', () => {
expect(exerciciosOptions.length).toBe(EXERCICIOS_POR_GRUPO.length);
expect(exerciciosOptions).toHaveLength(EXERCICIOS_POR_GRUPO.length);
});

it('each entry has a label matching the group name and a non-empty options array', () => {
Expand All @@ -30,11 +30,11 @@ describe('exerciciosOptions', () => {
for (const group of exerciciosOptions) {
for (const opt of group.options) {
expect(typeof opt.value).toBe('string');
expect(opt.value.length).toBeGreaterThan(0);
expect(opt.value.length).toBeGreaterThanOrEqual(1);
expect(typeof opt.label).toBe('string');
expect(opt.label.length).toBeGreaterThan(0);
expect(opt.label.length).toBeGreaterThanOrEqual(1);
expect(Array.isArray(opt.keywords)).toBe(true);
expect(opt.keywords.length).toBeGreaterThan(0);
expect(opt.keywords.length).toBeGreaterThanOrEqual(1);
}
}
});
Expand All @@ -43,12 +43,12 @@ describe('exerciciosOptions', () => {
describe('flatExerciciosOptions', () => {
it('is a non-empty array', () => {
expect(Array.isArray(flatExerciciosOptions)).toBe(true);
expect(flatExerciciosOptions.length).toBeGreaterThan(0);
expect(flatExerciciosOptions.length).toBeGreaterThanOrEqual(1);
});

it('contains the total count of all exercises across groups', () => {
const totalExercises = EXERCICIOS_POR_GRUPO.reduce((sum, g) => sum + g.exercicios.length, 0);
expect(flatExerciciosOptions.length).toBe(totalExercises);
expect(flatExerciciosOptions).toHaveLength(totalExercises);
});

it('each entry has value, label, and description', () => {
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('DEFAULT_EXERCISE', () => {

it('has repeticoes as a non-empty string', () => {
expect(typeof DEFAULT_EXERCISE.repeticoes).toBe('string');
expect(DEFAULT_EXERCISE.repeticoes.length).toBeGreaterThan(0);
expect(DEFAULT_EXERCISE.repeticoes.length).toBeGreaterThanOrEqual(1);
});
});

Expand Down
Loading