-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#164798023 Implement follow and unfollow feature #58
#164798023 Implement follow and unfollow feature #58
Conversation
…into ft-follow-unfollow-user-#164798023
…into ft-follow-unfollow-user-#164798023
- create follow and unfollow functions(CRUD) - write mock test using chai and mocha [Finishes #164798023]
…into feature/164798023-follow-unfollow-user
[Finishes #164798023]
- remove dead codes from follow controller
@@ -0,0 +1,165 @@ | |||
import chai, { expect } from 'chai'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
@@ -0,0 +1,118 @@ | |||
import model from '../models'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
@@ -0,0 +1,18 @@ | |||
import express from 'express'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: 'import' and 'export' may appear only with 'sourceType: module'
…into feature/164798023-follow-unfollow-user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, let's try to have JSDocs for each function also explaining the difference between follower
and followee
it's a bit confusing to understand what's happening
.filter( | ||
followed => | ||
followed.follower_id === followerId && | ||
followed.followee_id === followeeId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a more meaningful variable name in the map
function. Also what is the meaning of the variable userFollowing
? @amaechi-chuks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable userFollowing is a validation that checks for follower and followee in the database.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable userFollowing is a validation that checks for follower and followee in the database.
Can you describe what the variable is going to contain? Is it an object or array? And what will be its content(s)? @amaechi-chuks
…into feature/164798023-follow-unfollow-user
- use more descriptive variable name - update test cases - update create controller functions(callback and redirect) [Finishes #164798023]
…into feature/164798023-follow-unfollow-user
…into feature/164798023-follow-unfollow-user
done(); | ||
}); | ||
}); | ||
it('It should return a 200 status code if user unfollow successfully', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected parentheses around arrow function argument having a body with curly braces arrow-parens
done(); | ||
}); | ||
}); | ||
it('lgoin a user', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected parentheses around arrow function argument having a body with curly braces arrow-parens
}); | ||
}); | ||
describe('TEST USER UNFOLLOW', () => { | ||
it('Create a follower', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected parentheses around arrow function argument having a body with curly braces arrow-parens
done(); | ||
}); | ||
}); | ||
it('It should return a 406 if user try to follow him/herself', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected parentheses around arrow function argument having a body with curly braces arrow-parens
done(); | ||
}); | ||
}); | ||
it('It should return a 403 if user try to follow him/herself', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected parentheses around arrow function argument having a body with curly braces arrow-parens
}); | ||
}); | ||
|
||
it('It should return a 201 if a user is been followed successfully', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected parentheses around arrow function argument having a body with curly braces arrow-parens
done(); | ||
}); | ||
}); | ||
it('lgoin a user', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected parentheses around arrow function argument having a body with curly braces arrow-parens
let token2; | ||
let token3; | ||
describe('TEST USER FOLLOW', () => { | ||
it('Create a follower', done => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected parentheses around arrow function argument having a body with curly braces arrow-parens
chai.use(chaiHttp); | ||
let token1; | ||
let token2; | ||
let token3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'token3' is assigned a value but never used no-unused-vars
* @param {followerId} person following the user | ||
* @returns {object} response and user profile data | ||
*/ | ||
async followUser(req, res) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parsing error: Unexpected token followUser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you seen this? @amaechi-chuks
Description
This PR keep tabs of users following each other and by extension the articles they author.
Type of change
How Has This Been Tested?
http://localhost:6000/api/v1/follow/:followeeId
and received a responseSuccessfully followed user
from the serverhttp://localhost:6000/api/v1/follow/unFolloweeId
and received a responsesuccessfully unfollowed a user
Checklist:
chai and mocha
PT-ID
164798023
Screenshots
follow a user
unfollow a user
Background
N/A