Files
dashboard-cpsp/components/dashboard/__tests__/DashboardReportCtas.test.tsx
T
2026-08-26 13:46:05 +07:00

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();
});
});