fix some review comments

This commit is contained in:
Simone Taeggi 2023-06-01 18:25:16 +02:00
parent 417e130966
commit f33fc37a86
3 changed files with 8 additions and 1293 deletions

View File

@ -11,10 +11,9 @@ jest.mock('@strapi/helper-plugin', () => ({
useOverlayBlocker: () => ({ lockApp: jest.fn(), unlockApp: jest.fn() }),
}));
jest.mock('../../../utils', () => ({
...jest.requireActual('../../../utils'),
checkFormValidity: () => (null),
}));
const mockSchema = {
validate: () => true
}
const handlers = [
rest.put('*/providers/options', (req, res, ctx) =>
@ -57,9 +56,7 @@ describe('useSettingsForm', () => {
server.close();
});
test('fetches all the providers options', async () => {
const { result } = setup('/admin/providers/options', {
validate: jest.fn()
}, jest.fn(), ['autoRegister', 'defaultRole', 'ssoLockedRoles'] );
const { result } = setup('/admin/providers/options', mockSchema, jest.fn(), ['autoRegister', 'defaultRole', 'ssoLockedRoles'] );
expect(result.current[0].isLoading).toBe(true);
expect(result.current[0].formErrors).toStrictEqual({});
@ -110,8 +107,9 @@ describe('useSettingsForm', () => {
const cbSucc = jest.fn();
const { result } = setup('/admin/providers/options', {}, cbSucc, ['autoRegister', 'defaultRole', 'ssoLockedRoles'] );
const { result } = setup('/admin/providers/options', mockSchema, cbSucc, ['autoRegister', 'defaultRole', 'ssoLockedRoles'] );
await waitFor(() => expect(result.current[0].isLoading).toBe(false));
// call the handleSubmit handler to see if the data provided in modified data are cleaned without duplicates in the ssoLockedRoles list
const e = { preventDefault: jest.fn() };
await act(async () => {
await result.current[2].handleSubmit(e);

View File

@ -56,13 +56,11 @@ describe('ADMIN | Pages | Profile page | without SSO lock', () => {
server.close();
});
it('renders and matches the snapshot', async () => {
const { container } = setup();
it('renders and show the Interface Language section', async () => {
setup();
await waitFor(() => {
expect(screen.getByText('Interface language')).toBeInTheDocument();
});
expect(container.firstChild).toMatchSnapshot();
});
it('should display username if it exists', async () => {