Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
zburke committed May 31, 2024
1 parent d23abf6 commit 25df3f4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 55 deletions.
5 changes: 1 addition & 4 deletions src/okapiReducer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,5 @@ describe('okapiReducer', () => {
const o = okapiReducer(state, setServerDown());
expect(o).toMatchObject({ serverDown });
});




});

52 changes: 1 addition & 51 deletions src/processBadResponse.test.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,6 @@
import processBadResponse from './processBadResponse';

// const getLoginErrors = (payload) => {
// try {
// if (isObject(payload)) {
// const { errors } = payload;

// return errors;
// } else {
// const { errors } = JSON.parse(payload);

// return errors || [defaultErrors.DEFAULT_LOGIN_CLIENT_ERROR];
// }
// } catch (e) {
// return [defaultErrors.DEFAULT_LOGIN_CLIENT_ERROR];
// }
// };

// function getProcessedErrors(response, status, defaultClientError) {
// switch (status) {
// case 400:
// return [defaultClientError];
// case 422:
// return getLoginErrors(response);
// case 404: // Okapi's deployment of mod-users-bl hasn't completed
// case 500:
// return [defaultErrors.DEFAULT_LOGIN_SERVER_ERROR];
// default:
// return [defaultErrors.DEFAULT_LOGIN_CLIENT_ERROR];
// }
// }

// import { setAuthError } from './okapiActions';

// jest.mock('./okapiActions', () => ({
// setAuthError: (...rest) => rest,
// }));

import { defaultErrorCodes, defaultErrors } from './constants';
import { defaultErrors } from './constants';
import { setAuthError } from './okapiActions';

describe('processBadResponse', () => {
Expand Down Expand Up @@ -151,19 +115,5 @@ describe('processBadResponse', () => {
await processBadResponse(dispatch, response, message);
expect(dispatch).toHaveBeenCalledWith(message);
});

});

// export default async function processBadResponse(dispatch, response, defaultClientError) {
// const clientError = defaultClientError || defaultErrors.DEFAULT_LOGIN_CLIENT_ERROR;
// let actionPayload;

// try {
// const responseBody = await response.json();
// const responsePayload = responseBody.errorMessage || responseBody;
// actionPayload = getProcessedErrors(responsePayload, response.status, clientError);
// } catch (e) {
// actionPayload = [defaultErrors.DEFAULT_LOGIN_CLIENT_ERROR];
// }
// dispatch(setAuthError(actionPayload));
// }

0 comments on commit 25df3f4

Please sign in to comment.