mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-20 14:54:15 +01:00
(test) test AccountingCodesSettings
This commit is contained in:
parent
84dfcf38c7
commit
9d2dde8257
@ -37,6 +37,9 @@ export const server = setupServer(
|
||||
const { names } = req.params;
|
||||
const foundSettings = settings.filter(name => names.replace(/[[\]']/g, '').split(',').includes(name));
|
||||
return res(ctx.json(foundSettings));
|
||||
}),
|
||||
rest.patch('/api/settings/bulk_update', (req, res, ctx) => {
|
||||
return res(ctx.json(req.body));
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
import React from 'react';
|
||||
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(message => {});
|
||||
const onError = jest.fn(e => {});
|
||||
|
||||
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.getByLabelText(/app.admin.accounting_codes_settings.journal_code/)).toBeInTheDocument();
|
||||
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();
|
||||
});
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user