update all page to refresh immidiately without clicking sync button or refreshing the whole page
This commit is contained in:
1 parent
d5b0c12c40
commit
83a41fbbcb
15 files changed
+490
-151
No files matched your search
@@ -82,4 +82,23 @@ describe('DashboardManualInputForm', () => {
|
||||
expect(body).not.toHaveProperty('fcr_manual');
|
||||
expect(body).not.toHaveProperty('eef_manual');
|
||||
});
|
||||
|
||||
it('calls onSaved callback when manual input is successfully saved', async () => {
|
||||
const onSavedMock = vi.fn();
|
||||
render(<DashboardManualInputForm cycleId={4} currentDay={10} onSaved={onSavedMock} />);
|
||||
|
||||
expect(await screen.findByRole('heading', { name: /Input manual/i })).toBeInTheDocument();
|
||||
fireEvent.change(screen.getByLabelText(/Mortalitas/i), { target: { value: '5' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: /Simpan/i }));
|
||||
|
||||
await waitFor(() => expect(createMock).toHaveBeenCalledTimes(1));
|
||||
await waitFor(() => expect(onSavedMock).toHaveBeenCalledTimes(1));
|
||||
expect(onSavedMock).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
id: 1,
|
||||
cycle: 4,
|
||||
mortality_manual: 5,
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user