{}} />,
);
expect(container).toMatchSnapshot();
});
diff --git a/frontend/src/containers/DriverDetailContainer/DriverDetailContainer.js b/frontend/src/containers/DriverDetailContainer/DriverDetailContainer.js
index aa6817e..6ea4e03 100644
--- a/frontend/src/containers/DriverDetailContainer/DriverDetailContainer.js
+++ b/frontend/src/containers/DriverDetailContainer/DriverDetailContainer.js
@@ -2,7 +2,7 @@ import React, { useCallback } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { confirmCost } from '../../modules/group';
import { withRouter } from 'react-router-dom';
-import DriverDetail from '../../components/DriverDetail'
+import DriverDetail from '../../components/DriverDetail';
import { updatePoint } from '../../modules/user';
DriverDetailContainer.propTypes = {};
@@ -19,10 +19,11 @@ function DriverDetailContainer({ history }) {
({ userId, groupId, totalCost }) => {
//var totalCost = Math.floor(totalCost * 1.2 * 0.01) * 100;
var point = user.point + Math.floor(totalCost * 1.2 * 0.01) * 100;
- dispatch(confirmCost({groupId, totalCost}));
- dispatch(updatePoint({userId, point}));
+ dispatch(confirmCost({ groupId, totalCost }));
+ dispatch(updatePoint({ userId, point }));
history.push('/driverfinal');
- }, [dispatch, user, history],
+ },
+ [dispatch, user, history],
);
if (!user) {
@@ -32,13 +33,9 @@ function DriverDetailContainer({ history }) {
if (!group) {
return Waiting for group to be matched...
;
}
-
+
return (
-
+
);
}
diff --git a/frontend/src/containers/DriverDetailContainer/DriverDetailContainer.test.js b/frontend/src/containers/DriverDetailContainer/DriverDetailContainer.test.js
index 12efe32..507dca0 100644
--- a/frontend/src/containers/DriverDetailContainer/DriverDetailContainer.test.js
+++ b/frontend/src/containers/DriverDetailContainer/DriverDetailContainer.test.js
@@ -6,10 +6,10 @@ import { MemoryRouter, Route } from 'react-router-dom';
describe('', () => {
const initialState = {
user: {
- user: {id: 1},
+ user: { id: 1 },
},
group: {
- group: {groupId: 1},
+ group: { groupId: 1 },
},
};
diff --git a/frontend/src/containers/DriverFinalContainer/DriverFinalContainer.js b/frontend/src/containers/DriverFinalContainer/DriverFinalContainer.js
index 2bb22b7..d66bec3 100644
--- a/frontend/src/containers/DriverFinalContainer/DriverFinalContainer.js
+++ b/frontend/src/containers/DriverFinalContainer/DriverFinalContainer.js
@@ -1,7 +1,7 @@
import React, { useCallback } from 'react';
import { useSelector } from 'react-redux';
import { withRouter } from 'react-router-dom';
-import DriverFinal from '../../components/DriverFinal/DriverFinal'
+import DriverFinal from '../../components/DriverFinal/DriverFinal';
DriverFinalContainer.propTypes = {};
@@ -11,11 +11,9 @@ function DriverFinalContainer({ history }) {
group: group.group,
}));
- const onClickGoToMain = useCallback(
- () => {
- history.push('/requestcall');
- }, [history],
- );
+ const onClickGoToMain = useCallback(() => {
+ history.push('/requestcall');
+ }, [history]);
if (!user) {
return we are loading user...
;
@@ -24,7 +22,7 @@ function DriverFinalContainer({ history }) {
if (!group) {
return There is no group...
;
}
-
+
return (
);
-
}
export default withRouter(DriverFinalContainer);
diff --git a/frontend/src/containers/DriverFinalContainer/index.js b/frontend/src/containers/DriverFinalContainer/index.js
index 8fcb31c..fdf8a31 100644
--- a/frontend/src/containers/DriverFinalContainer/index.js
+++ b/frontend/src/containers/DriverFinalContainer/index.js
@@ -1,2 +1,2 @@
import DriverFinalContainer from './DriverFinalContainer';
-export default DriverFinalContainer;
\ No newline at end of file
+export default DriverFinalContainer;
diff --git a/frontend/src/containers/RiderDetailContainer/RiderDetailContainer.js b/frontend/src/containers/RiderDetailContainer/RiderDetailContainer.js
index ad28396..8bae363 100644
--- a/frontend/src/containers/RiderDetailContainer/RiderDetailContainer.js
+++ b/frontend/src/containers/RiderDetailContainer/RiderDetailContainer.js
@@ -35,13 +35,13 @@ function RiderDetailContainer({ history }) {
}),
);
dispatch(
- updatePoint({
- userId: user.user.id,
- point: user.point - parsed._rider_cost,
- }),
+ updatePoint({
+ userId: user.user.id,
+ point: user.point - parsed._rider_cost,
+ }),
);
history.push('/riderfinal');
- });
+ });
return () => {
dispatch(unloadGroup());
@@ -60,12 +60,7 @@ function RiderDetailContainer({ history }) {
return Waiting for group to be matched...
;
}
- return (
-
- );
-
+ return ;
}
export default withRouter(RiderDetailContainer);
diff --git a/frontend/src/containers/RiderDetailContainer/RiderDetailContainer.test.js b/frontend/src/containers/RiderDetailContainer/RiderDetailContainer.test.js
index 6cd4299..7a3b457 100644
--- a/frontend/src/containers/RiderDetailContainer/RiderDetailContainer.test.js
+++ b/frontend/src/containers/RiderDetailContainer/RiderDetailContainer.test.js
@@ -7,11 +7,11 @@ describe('', () => {
const initialState = {
user: {
user: {
- user:{id: 1},
- }
+ user: { id: 1 },
+ },
},
group: {
- group: {groupId: 1},
+ group: { groupId: 1 },
},
};
diff --git a/frontend/src/containers/RiderDetailContainer/index.js b/frontend/src/containers/RiderDetailContainer/index.js
index d1d1277..686676d 100644
--- a/frontend/src/containers/RiderDetailContainer/index.js
+++ b/frontend/src/containers/RiderDetailContainer/index.js
@@ -1,2 +1,2 @@
import RiderDetailContainer from './RiderDetailContainer';
-export default RiderDetailContainer;
\ No newline at end of file
+export default RiderDetailContainer;
diff --git a/frontend/src/containers/RiderFinalContainer/RiderFinalContainer.js b/frontend/src/containers/RiderFinalContainer/RiderFinalContainer.js
index 201a432..b97020d 100644
--- a/frontend/src/containers/RiderFinalContainer/RiderFinalContainer.js
+++ b/frontend/src/containers/RiderFinalContainer/RiderFinalContainer.js
@@ -1,7 +1,7 @@
import React, { useCallback } from 'react';
import { useSelector } from 'react-redux';
import { withRouter } from 'react-router-dom';
-import RiderFinal from '../../components/RiderFinal/RiderFinal'
+import RiderFinal from '../../components/RiderFinal/RiderFinal';
RiderFinalContainer.propTypes = {};
@@ -11,11 +11,9 @@ function RiderFinalContainer({ history }) {
group: group.group,
}));
- const onClickGoToMain = useCallback(
- () => {
- history.push('/request');
- }, [history],
- );
+ const onClickGoToMain = useCallback(() => {
+ history.push('/request');
+ }, [history]);
if (!user) {
return we are loading user...
;
@@ -24,14 +22,8 @@ function RiderFinalContainer({ history }) {
if (!group) {
return There is no group...
;
}
-
- return (
-
- );
-
+
+ return ;
}
export default withRouter(RiderFinalContainer);
diff --git a/frontend/src/containers/RiderFinalContainer/RiderFinalContainer.test.js b/frontend/src/containers/RiderFinalContainer/RiderFinalContainer.test.js
index 1e19eb2..70871f2 100644
--- a/frontend/src/containers/RiderFinalContainer/RiderFinalContainer.test.js
+++ b/frontend/src/containers/RiderFinalContainer/RiderFinalContainer.test.js
@@ -11,7 +11,7 @@ describe('', () => {
user: {
user: mockRider,
},
- group : mockGroup,
+ group: mockGroup,
};
const { container } = renderWithRedux(
diff --git a/frontend/src/containers/RiderFinalContainer/index.js b/frontend/src/containers/RiderFinalContainer/index.js
index 60f1549..fa18dc6 100644
--- a/frontend/src/containers/RiderFinalContainer/index.js
+++ b/frontend/src/containers/RiderFinalContainer/index.js
@@ -1,2 +1,2 @@
import RiderFinalContainer from './RiderFinalContainer';
-export default RiderFinalContainer;
\ No newline at end of file
+export default RiderFinalContainer;
diff --git a/frontend/src/lib/api/user/user.js b/frontend/src/lib/api/user/user.js
index 8f04679..87afb42 100644
--- a/frontend/src/lib/api/user/user.js
+++ b/frontend/src/lib/api/user/user.js
@@ -4,6 +4,6 @@ export function get({ id }) {
return client.get(`/api/v1/user/${id}`);
}
-export function updatePoint({ userId, point }){
+export function updatePoint({ userId, point }) {
return client.put(`/api/v1/user/${userId}`, { point });
-}
\ No newline at end of file
+}
diff --git a/frontend/src/lib/api/user/user.test.js b/frontend/src/lib/api/user/user.test.js
index efd7b35..3933709 100644
--- a/frontend/src/lib/api/user/user.test.js
+++ b/frontend/src/lib/api/user/user.test.js
@@ -28,5 +28,5 @@ describe('api/user', () => {
userAPI.updatePoint({ userId: 1, point: 1000 });
});
- })
+ });
});
diff --git a/frontend/src/modules/user/user.js b/frontend/src/modules/user/user.js
index a505086..6fd6d20 100644
--- a/frontend/src/modules/user/user.js
+++ b/frontend/src/modules/user/user.js
@@ -12,14 +12,19 @@ const [CHECK, CHECK_SUCCESS, CHECK_FAILURE] = createRequestActionTypes(
const [LOGOUT, LOGOUT_SUCCESS, LOGOUT_FAILURE] = createRequestActionTypes(
'user/LOGOUT',
);
-const [UPDATE_POINT, UPDATE_POINT_SUCCESS, UPDATE_POINT_FAILURE] = createRequestActionTypes(
- 'user/UPDATE_POINT',
-);
+const [
+ UPDATE_POINT,
+ UPDATE_POINT_SUCCESS,
+ UPDATE_POINT_FAILURE,
+] = createRequestActionTypes('user/UPDATE_POINT');
export const tempSetUser = createAction(TEMP_SET_USER, user => user);
export const check = createAction(CHECK, ({ id }) => ({ id }));
export const logout = createAction(LOGOUT);
-export const updatePoint = createAction(UPDATE_POINT, ({userId, point})=>({userId, point}));
+export const updatePoint = createAction(UPDATE_POINT, ({ userId, point }) => ({
+ userId,
+ point,
+}));
export const checkSaga = createRequestSaga(CHECK, userAPI.get);
export function checkFailureSaga() {
@@ -40,7 +45,10 @@ export function* logoutSaga() {
}
}
-export const updatePointSaga = createRequestSaga(UPDATE_POINT, userAPI.updatePoint)
+export const updatePointSaga = createRequestSaga(
+ UPDATE_POINT,
+ userAPI.updatePoint,
+);
export function* userSaga() {
yield takeLatest(CHECK, checkSaga);
yield takeLatest(CHECK_FAILURE, checkFailureSaga);
@@ -84,11 +92,11 @@ const user = handleActions(
...state,
user,
updatePointError: null,
- }),
- [UPDATE_POINT_FAILURE]: ( state, { payload: error }) => ({
+ }),
+ [UPDATE_POINT_FAILURE]: (state, { payload: error }) => ({
...state,
updatePointError: error,
- })
+ }),
},
initialState,
);
diff --git a/frontend/src/modules/user/user.test.js b/frontend/src/modules/user/user.test.js
index ea32762..da06cff 100644
--- a/frontend/src/modules/user/user.test.js
+++ b/frontend/src/modules/user/user.test.js
@@ -19,9 +19,9 @@ describe('user', () => {
describe('action', () => {
describe('UPDATE_POINT', () => {
it('should successfully create action', async () => {
- const action = updatePoint({userId: 1, point: 1000});
+ const action = updatePoint({ userId: 1, point: 1000 });
expect(action.type).toStrictEqual('user/UPDATE_POINT');
- expect(action.payload).toStrictEqual({userId: 1, point: 1000});
+ expect(action.payload).toStrictEqual({ userId: 1, point: 1000 });
});
});
@@ -68,7 +68,10 @@ describe('user', () => {
expect(
user(
{ user: { id: 'TEST_USER', point: 0 } },
- { type: 'user/UPDATE_POINT_SUCCESS', payload: { id: 'TEST_USER', point: 1234 } },
+ {
+ type: 'user/UPDATE_POINT_SUCCESS',
+ payload: { id: 'TEST_USER', point: 1234 },
+ },
),
).toStrictEqual({
user: { id: 'TEST_USER', point: 1234 },
@@ -82,7 +85,10 @@ describe('user', () => {
expect(
user(
{ user: { id: 'TEST_USER', point: 0 } },
- { type: 'user/UPDATE_POINT_FAILURE', payload: { error: 'TEST_ERROR' } },
+ {
+ type: 'user/UPDATE_POINT_FAILURE',
+ payload: { error: 'TEST_ERROR' },
+ },
),
).toStrictEqual({
user: { id: 'TEST_USER', point: 0 },
@@ -214,7 +220,7 @@ describe('user', () => {
sagaTester.dispatch({
type: 'user/UPDATE_POINT',
- payload: { id: 1, point: 1000},
+ payload: { id: 1, point: 1000 },
});
await sagaTester.waitFor('user/UPDATE_POINT_FAILURE');
diff --git a/frontend/src/pages/DriverDetailPage/DriverDetailPage.test.js b/frontend/src/pages/DriverDetailPage/DriverDetailPage.test.js
index a6d82a8..a7a645b 100644
--- a/frontend/src/pages/DriverDetailPage/DriverDetailPage.test.js
+++ b/frontend/src/pages/DriverDetailPage/DriverDetailPage.test.js
@@ -5,7 +5,6 @@ import { MemoryRouter, Route } from 'react-router-dom';
describe('', () => {
it('SHOULD match with snapshot', async () => {
-
const state = {
auth: {
auth: {
@@ -15,22 +14,21 @@ describe('', () => {
user: {
user: {
- id:1
+ id: 1,
},
},
group: {
group: {
- groupId: 1
+ groupId: 1,
},
},
};
-
const { container } = renderWithRedux(
,
- state
+ state,
);
expect(container).toMatchSnapshot();
});
diff --git a/frontend/src/pages/DriverFinalPage/DriverFinalPage.test.js b/frontend/src/pages/DriverFinalPage/DriverFinalPage.test.js
index 6b80893..1d9e5a9 100644
--- a/frontend/src/pages/DriverFinalPage/DriverFinalPage.test.js
+++ b/frontend/src/pages/DriverFinalPage/DriverFinalPage.test.js
@@ -5,7 +5,6 @@ import { MemoryRouter, Route } from 'react-router-dom';
describe('', () => {
it('SHOULD match with snapshot', async () => {
-
const state = {
auth: {
auth: {
@@ -15,12 +14,12 @@ describe('', () => {
user: {
user: {
id: 1,
- point: 50000
+ point: 50000,
},
},
group: {
group: {
- gourpId:1,
+ gourpId: 1,
cost: 5000,
},
},
diff --git a/frontend/src/pages/RiderDetailPage/RiderDetailPage.test.js b/frontend/src/pages/RiderDetailPage/RiderDetailPage.test.js
index 1461a03..d2ebfb0 100644
--- a/frontend/src/pages/RiderDetailPage/RiderDetailPage.test.js
+++ b/frontend/src/pages/RiderDetailPage/RiderDetailPage.test.js
@@ -5,7 +5,6 @@ import { MemoryRouter, Route } from 'react-router-dom';
describe('', () => {
it('SHOULD match with snapshot', async () => {
-
const state = {
auth: {
auth: {
@@ -15,24 +14,23 @@ describe('', () => {
user: {
user: {
- user:{
- id:1
- }
+ user: {
+ id: 1,
+ },
},
},
group: {
group: {
- groupId: 1
+ groupId: 1,
},
},
};
-
const { container } = renderWithRedux(
,
- state
+ state,
);
expect(container).toMatchSnapshot();
});
diff --git a/frontend/src/pages/RiderFinalPage/RiderFinalPage.js b/frontend/src/pages/RiderFinalPage/RiderFinalPage.js
index e133571..a7dfcf7 100644
--- a/frontend/src/pages/RiderFinalPage/RiderFinalPage.js
+++ b/frontend/src/pages/RiderFinalPage/RiderFinalPage.js
@@ -3,9 +3,6 @@ import Main from '../_layouts/Main';
//import RiderFinalContainer from '../../containers/RiderFinalContainer/RiderFinalContainer';
function RiderFinalPage() {
- return (
-
-
- );
+ return ;
}
export default RiderFinalPage;
diff --git a/frontend/src/pages/RiderFinalPage/RiderFinalPage.test.js b/frontend/src/pages/RiderFinalPage/RiderFinalPage.test.js
index 27f0536..b40edc7 100644
--- a/frontend/src/pages/RiderFinalPage/RiderFinalPage.test.js
+++ b/frontend/src/pages/RiderFinalPage/RiderFinalPage.test.js
@@ -5,7 +5,6 @@ import { MemoryRouter, Route } from 'react-router-dom';
describe('', () => {
it('SHOULD match with snapshot', async () => {
-
const state = {
auth: {
auth: {
@@ -15,14 +14,14 @@ describe('', () => {
user: {
user: {
user: {
- id:1
+ id: 1,
},
- point: 50000
+ point: 50000,
},
},
group: {
group: {
- gourpId:1,
+ gourpId: 1,
cost: 5000,
},
},
diff --git a/frontend/src/types/__mock__/group.js b/frontend/src/types/__mock__/group.js
index 7acfdd1..aca73ab 100644
--- a/frontend/src/types/__mock__/group.js
+++ b/frontend/src/types/__mock__/group.js
@@ -1,6 +1,5 @@
export const mockGroup = {
- groupId: 1,
- from: "from",
- to: "to"
- };
-
\ No newline at end of file
+ groupId: 1,
+ from: 'from',
+ to: 'to',
+};