Skip to content

Commit

Permalink
#168049945 Users should be able to view and edit their profiles (#15)
Browse files Browse the repository at this point in the history
* feature(user-profile): add view and edit profile
- user can view and edit his/her profile
[Finish #168049945]
  • Loading branch information
mucyomiller committed Nov 15, 2019
1 parent 9796a28 commit c8819d5
Show file tree
Hide file tree
Showing 74 changed files with 1,574 additions and 366 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"env": {
"browser": true,
"es6": true
"es6": true,
"jest": true
},
"extends": [
"airbnb"
Expand All @@ -10,6 +11,7 @@
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
Expand Down
90 changes: 66 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.25",
"@fortawesome/free-solid-svg-icons": "^5.11.2",
"@fortawesome/react-fontawesome": "^0.1.7",
"@sentry/browser": "^5.7.1",
"@storybook/addon-actions": "^5.2.5",
"@storybook/addon-links": "^5.2.5",
Expand All @@ -12,20 +15,21 @@
"history": "^4.10.1",
"joi-browser": "^13.4.0",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.15",
"moment": "^2.24.0",
"node-sass": "^4.13.0",
"nyc": "^14.1.1",
"moxios": "^0.4.0",
"prop-types": "^15.7.2",
"query-string": "^6.9.0",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-redux": "^7.1.1",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.2.0",
"react-toastify": "^5.4.0",
"redux": "^4.0.4",
"redux-devtools-extension": "^2.13.8",
"redux-api-middleware": "^3.0.1",
"redux-devtools-extension": "^2.13.8",
"redux-mock-store": "^1.5.3",
"redux-thunk": "^2.3.0"
},
Expand All @@ -41,7 +45,10 @@
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!<rootDir>/node_modules/"
"!<rootDir>/node_modules/",
"!src/**/*.stories.js",
"!src/index.js",
"!src/serviceWorker.js"
],
"coverageReporters": [
"json-summary",
Expand Down
23 changes: 23 additions & 0 deletions src/__mocks__/__profile_data_success__.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"id": 5,
"firstname": "firstname",
"lastname": "user",
"email": "requester@request.com",
"username": "requesting",
"is_verified": true,
"role_value": 1,
"phone": null,
"gender": "Male",
"dob": null,
"address": null,
"country": null,
"language": null,
"currency": null,
"image_url": "https://avatars0.githubusercontent.com/u/11447549?s=460&v=4",
"company": null,
"department": null,
"line_manager": "manager@admin.com",
"isEmailAllowed": "true",
"createdAt": "2019-10-11T10:50:28.214Z",
"updatedAt": "2019-11-12T09:49:06.152Z"
}
9 changes: 9 additions & 0 deletions src/__mocks__/__profile_response_error__.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"status": 400,
"response": {
"data": {
"status": 400,
"error": "User id must be an Integer"
}
}
}
32 changes: 32 additions & 0 deletions src/__mocks__/__profile_response_success.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"status": 200,
"response": {
"data": {
"status": 200,
"message": "User found!",
"data": {
"id": 5,
"firstname": "firstname",
"lastname": "user",
"email": "requester@request.com",
"username": "requesting",
"is_verified": true,
"role_value": 1,
"phone": null,
"gender": "Male",
"dob": null,
"address": null,
"country": null,
"language": null,
"currency": null,
"image_url": "https://avatars0.githubusercontent.com/u/11447549?s=460&v=4",
"company": null,
"department": null,
"line_manager": "manager@admin.com",
"isEmailAllowed": "true",
"createdAt": "2019-10-11T10:50:28.214Z",
"updatedAt": "2019-11-12T09:49:06.152Z"
}
}
}
}
11 changes: 11 additions & 0 deletions src/__mocks__/__profile_update_error__.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"status": 400,
"response": {
"data": {
"status": 400,
"errors": [
"genders is not allowed"
]
}
}
}
12 changes: 12 additions & 0 deletions src/__mocks__/__profile_update_success__.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"status": 200,
"response": {
"data": {
"status": 200,
"message": "Profile Updated!",
"data": {
"gender": "Male"
}
}
}
}
32 changes: 17 additions & 15 deletions src/__mocks__/fixtures.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
export const loginPayload = {
token: 'test token',
user: { email: 'test user' }
}
token: "test token",
user: { email: "test user" },
};

export const payload = {
status: 20,
message: "Sign up the",
data: {
id: 28,
email: "amilylisy@yahoo.com",
firstname: "amily",
lastname: "kassim",
role_value: 1,
username: "amilykassim",
},
token: "eyJhbGcibK-l8Ic4",
};
status: 20,
message: "Sign up the",
data: {
id: 28,
email: "amilylisy@yahoo.com",
firstname: "amily",
lastname: "kassim",
role_value: 1,
username: "amilykassim",
},
token: "eyJhbGcibK-l8Ic4",
};

export const token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MTAsImZpcnN0bmFtZSI6IkZyZWQiLCJsYXN0bmFtZSI6Ik11Y3lvIiwiZW1haWwiOiJtdWN5b21pbGxlckBnbWFpbC5jb20iLCJ1c2VybmFtZSI6bnVsbCwiaXNfdmVyaWZpZWQiOnRydWUsInJvbGVfdmFsdWUiOjEsInBob25lIjpudWxsLCJnZW5kZXIiOiJNYWxlIiwiZG9iIjoiMTk5NC0wNS0wMlQwMDowMDowMC4wMDBaIiwiYWRkcmVzcyI6Im51bGwiLCJjb3VudHJ5IjoibnVsbCIsImxhbmd1YWdlIjoibnVsbCIsImN1cnJlbmN5IjoibnVsbCIsImltYWdlX3VybCI6Imh0dHA6Ly9yZXMuY2xvdWRpbmFyeS5jb20vdGVjaG5pdGVzL2ltYWdlL3VwbG9hZC92MTU3MzgwODYzNy9tdHd3a2ExZHh0aWVrd3Nncmlvai5qcGciLCJjb21wYW55IjoiQW5kZWxhIiwiZGVwYXJ0bWVudCI6IkVuZ2luZWVyaW5nIiwibGluZV9tYW5hZ2VyIjoicnVndW1iaXJham9yZHliYXN0aWVuQGdtYWlsLmNvbSIsImlzRW1haWxBbGxvd2VkIjoidHJ1ZSIsImlhdCI6MTU3MzgwODg1NiwiZXhwIjoxNTczODk1MjU2fQ._fvFcTCo7YdJ1yL_X_iVFOrby5k5b3bcrOb0f9DQpEo";
Loading

0 comments on commit c8819d5

Please sign in to comment.