22 lines
733 B
TypeScript
22 lines
733 B
TypeScript
import { fireEvent, render, screen } from '@testing-library/react';
|
|
import DashboardReportCtas from '../DashboardReportCtas.tsx';
|
|
|
|
describe('DashboardReportCtas', () => {
|
|
it('disables end-cycle until the cycle is closed', () => {
|
|
const onOpenDaily = vi.fn();
|
|
const onOpenEndCycle = vi.fn();
|
|
render(
|
|
<DashboardReportCtas
|
|
cycleClosed={false}
|
|
hasDailySnapshot={false}
|
|
hasEndCycleSnapshot={false}
|
|
onOpenDaily={onOpenDaily}
|
|
onOpenEndCycle={onOpenEndCycle}
|
|
/>
|
|
);
|
|
expect(screen.getByRole('button', { name: /Akhir Siklus/i })).toBeDisabled();
|
|
fireEvent.click(screen.getByRole('button', { name: /Harian/i }));
|
|
expect(onOpenDaily).toHaveBeenCalled();
|
|
});
|
|
});
|