mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-13 23:48:55 +01:00
23 lines
1.3 KiB
TypeScript
23 lines
1.3 KiB
TypeScript
import { AccountingCodesSettings } from 'components/accounting/accounting-codes-settings';
|
|
import { render, fireEvent, waitFor, screen } from '@testing-library/react';
|
|
import '@testing-library/jest-dom';
|
|
|
|
describe('AccountingCodesSettings', () => {
|
|
const onSuccess = jest.fn();
|
|
const onError = jest.fn();
|
|
|
|
test('render AccountingCodesSettings', async () => {
|
|
render(<AccountingCodesSettings onError={onError} onSuccess={onSuccess} />);
|
|
await waitFor(() => screen.getByRole('heading', { name: /app.admin.accounting_codes_settings.advanced_accounting/ }));
|
|
expect(screen.getByLabelText(/app.admin.accounting_codes_settings.enable_advanced/)).toBeInTheDocument();
|
|
expect(screen.getAllByLabelText(/app.admin.accounting_codes_settings.journal_code/)).toHaveLength(6);
|
|
expect(screen.getAllByLabelText(/app.admin.accounting_codes_settings.code/)).toHaveLength(13);
|
|
expect(screen.getAllByLabelText(/app.admin.accounting_codes_settings.label/)).toHaveLength(13);
|
|
expect(screen.getByRole('button', { name: /app.admin.accounting_codes_settings.save/ })).toBeInTheDocument();
|
|
fireEvent.click(screen.getByRole('button', { name: /app.admin.accounting_codes_settings.save/ }));
|
|
await waitFor(() => {
|
|
expect(onSuccess).toHaveBeenCalledWith('app.admin.accounting_codes_settings.update_success');
|
|
});
|
|
});
|
|
});
|