{"action":"created","comment":{"url":"https://api.github.com/repos/andela/thor-ah/pulls/comments/214544692","pull_request_review_id":151624809,"id":214544692,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDU0NDY5Mg==","diff_hunk":"@@ -0,0 +1,118 @@\n+import chai, { expect } from 'chai';\n+import chaiHttp from 'chai-http';\n+import jwt from 'jsonwebtoken';\n+import env from 'dotenv';\n+import app from '../../..';\n+\n+chai.use(chaiHttp);\n+env.config();\n+chai.should();\n+\n+const user = {\n+  username: 'andelan',\n+  firstName: 'Emeka',\n+  lastName: 'Chinedu',\n+  email: 'emekag@gmail.com',\n+  password: 'emeka'\n+};\n+\n+const existingUsername = {\n+  username: 'andelan',\n+  firstName: 'Emeka',\n+  lastName: 'Chinedu',\n+  email: 'emekbros@gmail.com',\n+  password: 'emeka'\n+};\n+\n+const existingEmail = {\n+  username: 'andelani',\n+  firstName: 'Emeka',\n+  lastName: 'Chinedu',\n+  email: 'emekag@gmail.com',\n+  password: 'emeka'\n+};\n+\n+const correctDetails = { email: 'emekag@gmail.com', password: 'emeka' };\n+const incorrectDetails = { email: 'emekag@gmail.com', password: 'wrongpassword' };\n+const emptyEmailField = { email: '', password: 'emeka' };\n+const emptyPasswordField = { email: 'emekag@gmail.com', password: '' };\n+\n+describe('Test for users controllers', () => {\n+  describe('POST /api/users for users signup', () => {\n+    it('should successfully register a new user', (done) => {\n+      chai.request(app)\n+        .post('/api/users')\n+        .send(user)\n+        .end((error, res) => {\n+          const { userDetails } = res.body;\n+          expect(res).to.have.status(201);\n+          userDetails.should.have.property('firstName');\n+          userDetails.should.have.property('lastName');\n+          userDetails.should.have.property('email');\n+          done();\n+        });\n+    });\n+    it('should return a bad request error message if username already exists in database', (done) => {\n+      chai.request(app)\n+        .post('/api/users')\n+        .send(existingUsername)\n+        .end((error, res) => {\n+          expect(res).to.have.status(400);\n+          res.body.errors.username.should.equal('This username has already been registered');\n+          done();\n+        });\n+    });\n+    it('should return a bad request error message if email already exists in database', (done) => {\n+      chai.request(app)\n+        .post('/api/users')\n+        .send(existingEmail)\n+        .end((error, res) => {\n+          expect(res).to.have.status(400);\n+          res.body.errors.email.should.equal('This email has already been registered');\n+          done();\n+        });\n+    });\n+  });\n+  describe('POST /api/users/login for users login', () => {\n+    it('should successfully login a registered user', (done) => {\n+      chai.request(app)\n+        .post('/api/users/login')\n+        .send(correctDetails)\n+        .end((error, res) => {\n+          expect(res).to.have.status(200);\n+          res.body.message.should.equal('Login successful');\n+          done();\n+        });\n+    });\n+    it('should send a bad request error message if user logs in with the wrong password', (done) => {\n+      chai.request(app)\n+        .post('/api/users/login')\n+        .send(incorrectDetails)\n+        .end((error, res) => {\n+          expect(res).to.have.status(400);\n+          res.body.errors.password.should.equal('Incorrect Password');\n+          done();\n+        });\n+    });\n+    it('should send a bad request error message if user logs in with empty email field', (done) => {\n+      chai.request(app)\n+        .post('/api/users/login')\n+        .send(emptyEmailField)\n+        .end((error, res) => {\n+          expect(res).to.have.status(400);\n+          res.body.errors.email.should.equal('Please enter your registered email');\n+          done();\n+        });\n+    });\n+    it('should send a bad request error message if user logs in with empty password field', (done) => {\n+      chai.request(app)\n+        .post('/api/users/login')\n+        .send(emptyPasswordField)\n+        .end((error, res) => {","path":"server/tests/controllers/users.js","position":111,"original_position":111,"commit_id":"7cf9ff8398acebe578a54bc67c1db96ddf66e15f","original_commit_id":"7cf9ff8398acebe578a54bc67c1db96ddf66e15f","user":{"login":"houndci-bot","id":6697940,"node_id":"MDQ6VXNlcjY2OTc5NDA=","avatar_url":"https://avatars0.githubusercontent.com/u/6697940?v=4","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"'arrow function syntax (=>)' is only available in ES6 (use 'esversion: 6').","created_at":"2018-09-02T15:30:33Z","updated_at":"2018-09-02T15:30:33Z","html_url":"https://github.com/andela/thor-ah/pull/18#discussion_r214544692","pull_request_url":"https://api.github.com/repos/andela/thor-ah/pulls/18","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/comments/214544692"},"html":{"href":"https://github.com/andela/thor-ah/pull/18#discussion_r214544692"},"pull_request":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/18"}}},"pull_request":{"url":"https://api.github.com/repos/andela/thor-ah/pulls/18","id":212595596,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNTk1NTk2","html_url":"https://github.com/andela/thor-ah/pull/18","diff_url":"https://github.com/andela/thor-ah/pull/18.diff","patch_url":"https://github.com/andela/thor-ah/pull/18.patch","issue_url":"https://api.github.com/repos/andela/thor-ah/issues/18","number":18,"state":"open","locked":false,"title":"#159987699 Users should be able to see other users' profile and update their own profile","user":{"login":"emekafredy","id":29521319,"node_id":"MDQ6VXNlcjI5NTIxMzE5","avatar_url":"https://avatars3.githubusercontent.com/u/29521319?v=4","gravatar_id":"","url":"https://api.github.com/users/emekafredy","html_url":"https://github.com/emekafredy","followers_url":"https://api.github.com/users/emekafredy/followers","following_url":"https://api.github.com/users/emekafredy/following{/other_user}","gists_url":"https://api.github.com/users/emekafredy/gists{/gist_id}","starred_url":"https://api.github.com/users/emekafredy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emekafredy/subscriptions","organizations_url":"https://api.github.com/users/emekafredy/orgs","repos_url":"https://api.github.com/users/emekafredy/repos","events_url":"https://api.github.com/users/emekafredy/events{/privacy}","received_events_url":"https://api.github.com/users/emekafredy/received_events","type":"User","site_admin":false},"body":"# What does this PR do?\r\nCreate endpoints for users profile\r\n\r\n# Description of Task to be completed?\r\n### Modify the following endpoints\r\n- User signup ``` POST api/users ```\r\n- User login ``` POST api/users/login ```\r\n### Create the following endpoints\r\n- Get users profiles ``` GET api/users ```\r\n- Get user profile by username ``` GET api/users/<username> ```\r\n- Update user profile ``` PUT api/users/<userId> ```\r\n### Write tests for users profile\r\n\r\n# How should this be manually tested?\r\n- Clone the repo\r\n- cd into the 'Thor-ah'\r\n- Run 'npm install'\r\n- Use the .env.sample format to create a .env file\r\n- Run 'npm run migrate'\r\n- Run 'npm run start:dev'\r\n\r\n# Any background context you want to provide?\r\nN/A\r\n# What are the relevant pivotal tracker stories?\r\n[159987699](https://www.pivotaltracker.com/story/show/159987699)\r\n\r\n# Screenshots (if appropriate)\r\nN/A\r\n\r\n# Questions:\r\nN/A\r\n","created_at":"2018-09-02T14:30:46Z","updated_at":"2018-09-02T15:30:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f3422272a556fe604826d1aea3ac039904942735","assignee":null,"assignees":[],"requested_reviewers":[{"login":"aknwosu","id":24938070,"node_id":"MDQ6VXNlcjI0OTM4MDcw","avatar_url":"https://avatars3.githubusercontent.com/u/24938070?v=4","gravatar_id":"","url":"https://api.github.com/users/aknwosu","html_url":"https://github.com/aknwosu","followers_url":"https://api.github.com/users/aknwosu/followers","following_url":"https://api.github.com/users/aknwosu/following{/other_user}","gists_url":"https://api.github.com/users/aknwosu/gists{/gist_id}","starred_url":"https://api.github.com/users/aknwosu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aknwosu/subscriptions","organizations_url":"https://api.github.com/users/aknwosu/orgs","repos_url":"https://api.github.com/users/aknwosu/repos","events_url":"https://api.github.com/users/aknwosu/events{/privacy}","received_events_url":"https://api.github.com/users/aknwosu/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/andela/thor-ah/pulls/18/commits","review_comments_url":"https://api.github.com/repos/andela/thor-ah/pulls/18/comments","review_comment_url":"https://api.github.com/repos/andela/thor-ah/pulls/comments{/number}","comments_url":"https://api.github.com/repos/andela/thor-ah/issues/18/comments","statuses_url":"https://api.github.com/repos/andela/thor-ah/statuses/7cf9ff8398acebe578a54bc67c1db96ddf66e15f","head":{"label":"andela:ft-create-profile-159987699","ref":"ft-create-profile-159987699","sha":"7cf9ff8398acebe578a54bc67c1db96ddf66e15f","user":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":145831905,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU4MzE5MDU=","name":"thor-ah","full_name":"andela/thor-ah","owner":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/thor-ah","description":"Staging Link for Author's Haven ","fork":false,"url":"https://api.github.com/repos/andela/thor-ah","forks_url":"https://api.github.com/repos/andela/thor-ah/forks","keys_url":"https://api.github.com/repos/andela/thor-ah/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/thor-ah/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/thor-ah/teams","hooks_url":"https://api.github.com/repos/andela/thor-ah/hooks","issue_events_url":"https://api.github.com/repos/andela/thor-ah/issues/events{/number}","events_url":"https://api.github.com/repos/andela/thor-ah/events","assignees_url":"https://api.github.com/repos/andela/thor-ah/assignees{/user}","branches_url":"https://api.github.com/repos/andela/thor-ah/branches{/branch}","tags_url":"https://api.github.com/repos/andela/thor-ah/tags","blobs_url":"https://api.github.com/repos/andela/thor-ah/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/thor-ah/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/thor-ah/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/thor-ah/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/thor-ah/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/thor-ah/languages","stargazers_url":"https://api.github.com/repos/andela/thor-ah/stargazers","contributors_url":"https://api.github.com/repos/andela/thor-ah/contributors","subscribers_url":"https://api.github.com/repos/andela/thor-ah/subscribers","subscription_url":"https://api.github.com/repos/andela/thor-ah/subscription","commits_url":"https://api.github.com/repos/andela/thor-ah/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/thor-ah/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/thor-ah/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/thor-ah/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/thor-ah/contents/{+path}","compare_url":"https://api.github.com/repos/andela/thor-ah/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/thor-ah/merges","archive_url":"https://api.github.com/repos/andela/thor-ah/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/thor-ah/downloads","issues_url":"https://api.github.com/repos/andela/thor-ah/issues{/number}","pulls_url":"https://api.github.com/repos/andela/thor-ah/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/thor-ah/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/thor-ah/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/thor-ah/labels{/name}","releases_url":"https://api.github.com/repos/andela/thor-ah/releases{/id}","deployments_url":"https://api.github.com/repos/andela/thor-ah/deployments","created_at":"2018-08-23T09:31:23Z","updated_at":"2018-09-01T21:17:49Z","pushed_at":"2018-09-02T15:30:22Z","git_url":"git://github.com/andela/thor-ah.git","ssh_url":"git@github.com:andela/thor-ah.git","clone_url":"https://github.com/andela/thor-ah.git","svn_url":"https://github.com/andela/thor-ah","homepage":"https://thor-ah-staging.herokuapp.com/","size":114,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":5,"default_branch":"develop"}},"base":{"label":"andela:develop","ref":"develop","sha":"1424f380bbc52c905e97d73a4400f9a4e8ecb14c","user":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"repo":{"id":145831905,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU4MzE5MDU=","name":"thor-ah","full_name":"andela/thor-ah","owner":{"login":"andela","id":4100206,"node_id":"MDEyOk9yZ2FuaXphdGlvbjQxMDAyMDY=","avatar_url":"https://avatars2.githubusercontent.com/u/4100206?v=4","gravatar_id":"","url":"https://api.github.com/users/andela","html_url":"https://github.com/andela","followers_url":"https://api.github.com/users/andela/followers","following_url":"https://api.github.com/users/andela/following{/other_user}","gists_url":"https://api.github.com/users/andela/gists{/gist_id}","starred_url":"https://api.github.com/users/andela/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andela/subscriptions","organizations_url":"https://api.github.com/users/andela/orgs","repos_url":"https://api.github.com/users/andela/repos","events_url":"https://api.github.com/users/andela/events{/privacy}","received_events_url":"https://api.github.com/users/andela/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/andela/thor-ah","description":"Staging Link for Author's Haven ","fork":false,"url":"https://api.github.com/repos/andela/thor-ah","forks_url":"https://api.github.com/repos/andela/thor-ah/forks","keys_url":"https://api.github.com/repos/andela/thor-ah/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andela/thor-ah/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andela/thor-ah/teams","hooks_url":"https://api.github.com/repos/andela/thor-ah/hooks","issue_events_url":"https://api.github.com/repos/andela/thor-ah/issues/events{/number}","events_url":"https://api.github.com/repos/andela/thor-ah/events","assignees_url":"https://api.github.com/repos/andela/thor-ah/assignees{/user}","branches_url":"https://api.github.com/repos/andela/thor-ah/branches{/branch}","tags_url":"https://api.github.com/repos/andela/thor-ah/tags","blobs_url":"https://api.github.com/repos/andela/thor-ah/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andela/thor-ah/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andela/thor-ah/git/refs{/sha}","trees_url":"https://api.github.com/repos/andela/thor-ah/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andela/thor-ah/statuses/{sha}","languages_url":"https://api.github.com/repos/andela/thor-ah/languages","stargazers_url":"https://api.github.com/repos/andela/thor-ah/stargazers","contributors_url":"https://api.github.com/repos/andela/thor-ah/contributors","subscribers_url":"https://api.github.com/repos/andela/thor-ah/subscribers","subscription_url":"https://api.github.com/repos/andela/thor-ah/subscription","commits_url":"https://api.github.com/repos/andela/thor-ah/commits{/sha}","git_commits_url":"https://api.github.com/repos/andela/thor-ah/git/commits{/sha}","comments_url":"https://api.github.com/repos/andela/thor-ah/comments{/number}","issue_comment_url":"https://api.github.com/repos/andela/thor-ah/issues/comments{/number}","contents_url":"https://api.github.com/repos/andela/thor-ah/contents/{+path}","compare_url":"https://api.github.com/repos/andela/thor-ah/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andela/thor-ah/merges","archive_url":"https://api.github.com/repos/andela/thor-ah/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andela/thor-ah/downloads","issues_url":"https://api.github.com/repos/andela/thor-ah/issues{/number}","pulls_url":"https://api.github.com/repos/andela/thor-ah/pulls{/number}","milestones_url":"https://api.github.com/repos/andela/thor-ah/milestones{/number}","notifications_url":"https://api.github.com/repos/andela/thor-ah/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andela/thor-ah/labels{/name}","releases_url":"https://api.github.com/repos/andela/thor-ah/releases{/id}","deployments_url":"https://api.github.com/repos/andela/thor-ah/deployments","created_at":"2018-08-23T09:31:23Z","updated_at":"2018-09-01T21:17:49Z","pushed_at":"2018-09-02T15:30:22Z","git_url":"git://github.com/andela/thor-ah.git","ssh_url":"git@github.com:andela/thor-ah.git","clone_url":"https://github.com/andela/thor-ah.git","svn_url":"https://github.com/andela/thor-ah","homepage":"https://thor-ah-staging.herokuapp.com/","size":114,"stargazers_count":5,"watchers_count":5,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":3,"license":null,"forks":0,"open_issues":3,"watchers":5,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/18"},"html":{"href":"https://github.com/andela/thor-ah/pull/18"},"issue":{"href":"https://api.github.com/repos/andela/thor-ah/issues/18"},"comments":{"href":"https://api.github.com/repos/andela/thor-ah/issues/18/comments"},"review_comments":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/18/comments"},"review_comment":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/andela/thor-ah/pulls/18/commits"},"statuses":{"href":"https://api.github.com/repos/andela/thor-ah/statuses/7cf9ff8398acebe578a54bc67c1db96ddf66e15f"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"houndci-bot"}}