Skip to content
Snippets Groups Projects

Resolve "[MIN-321] form for reporting errors in minerva"

Merged Piotr Gawron requested to merge 254-min-321-form-for-reporting-errors-in-minerva into development
2 files
+ 25
0
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -5,12 +5,15 @@ import {
ToolkitStoreWithSingleSlice,
createStoreInstanceUsingSliceReducer,
} from '@/utils/createStoreInstanceUsingSliceReducer';
import { showToast } from '@/utils/showToast';
import { apiPath } from '../apiPath';
import { closeModal } from '../modal/modal.slice';
import userReducer from './user.slice';
import { UserState } from './user.types';
import { login } from './user.thunks';
jest.mock('../../utils/showToast');
const mockedAxiosClient = mockNetworkResponse();
const CREDENTIALS = {
login: 'test',
@@ -50,4 +53,15 @@ describe('login thunk', () => {
await store.dispatch(login(CREDENTIALS));
});
it('dispatch showToast on failed login with invalid data', async () => {
mockedAxiosClient.onPost(apiPath.postLogin()).reply(HttpStatusCode.Unauthorized, loginFixture);
await store.dispatch(login(CREDENTIALS));
expect(showToast).toHaveBeenCalledWith({
message: 'Invalid credentials.',
type: 'error',
});
});
});
Loading