-
Notifications
You must be signed in to change notification settings - Fork 7
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
#165273535 : Add comment on article #28
base: develop
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,17 @@ | |||
// comment constants | |||
import { ADD_COMMENT } from 'store/actions/commentTypes'; |
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,33 @@ | |||
import commentReducer from 'store/reducers/commentReducer'; |
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'
src/store/actions/commentTypes.js
Outdated
@@ -0,0 +1,2 @@ | |||
// eslint-disable-next-line import/prefer-default-export | |||
export const ADD_COMMENT = 'ADD_COMMENT'; |
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,41 @@ | |||
// Import axios | |||
import axios from 'axios'; |
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,44 @@ | |||
// helper functions | |||
import { ADD_COMMENT } from 'store/actions/commentTypes'; |
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'
e9ffe89
to
534ad55
Compare
}); | ||
|
||
it('should handle add comment errors', () => { | ||
expect( |
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.
'expect' is not defined no-undef
); | ||
}); | ||
it('should handle Add new comment', () => { | ||
expect( |
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.
'expect' is not defined no-undef
|
||
describe('loginReducer state', () => { | ||
it('should return the initial state', () => { | ||
expect(commentReducer(undefined, {})).toEqual( |
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.
'expect' is not defined no-undef
|
||
return store.dispatch(createComment('article_slug', 'bdy')) | ||
.then(() => { | ||
expect(store.getActions()).toEqual(expectedActions); |
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.
'expect' is not defined no-undef
src/components/comment/index.js
Outdated
}; | ||
} | ||
|
||
handleCommentSubmit = (e) => { |
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 =
beforeEach(() => { | ||
store = mockStore(initialState); | ||
moxios.install(); | ||
wrapper = shallow(<CommentForm store={store} {...props} />); |
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 <
8eb944d
to
950414d
Compare
); | ||
}); | ||
it('should handle loading status for comment', () => { | ||
expect( |
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.
'expect' is not defined no-undef
}; | ||
/** | ||
* This function deletes a comment for a specific article | ||
* @param {string} article_slug |
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 JSDoc for 'articleSlug' but found 'article_slug' valid-jsdoc
|
||
/** | ||
* This function gets a list of comments for a specific article | ||
* @param {string} article_slug |
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 JSDoc for 'articleSlug' but found 'article_slug' valid-jsdoc
src/components/comment/index.js
Outdated
} = this.props; | ||
|
||
const commentList = comments.reverse().map(comment => ( | ||
<CommentBox |
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 <
const DeleteComment = ({ | ||
id, author, articleSlug, deleteComment | ||
}) => ( | ||
<Fragment> |
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 <
}; | ||
} | ||
|
||
handleCommentSubmit = (e) => { |
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 =
src/components/comment/CommentBox.js
Outdated
id, author: { username, }, created_at, body, articleSlug, deleteComment | ||
} | ||
) => ( | ||
<div className="comment"> |
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 <
950414d
to
90c52fb
Compare
src/components/comment/index.js
Outdated
import CommentBox from 'components/Comment/CommentBox'; | ||
|
||
export class Comment extends Component { | ||
static propTypes = { |
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 =
|
||
|
||
beforeEach(() => { | ||
wrapper = shallow(<CommentForm {...props} />); |
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 <
6181b0a
to
0cab835
Compare
import CommentBox from 'components/Comment/CommentBox'; | ||
|
||
export class Comment extends Component { | ||
static propTypes = { |
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 =
const DeleteComment = ({ | ||
id, author, articleSlug, deleteComment | ||
}) => ( | ||
<Fragment> |
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 <
|
||
|
||
beforeEach(() => { | ||
wrapper = shallow(<CommentForm {...props} />); |
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 <
}; | ||
} | ||
|
||
handleCommentSubmit = (e) => { |
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 =
id, author: { username, }, created_at, body, articleSlug, deleteComment | ||
} | ||
) => ( | ||
<div className="comment"> |
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 <
0cab835
to
cc454c0
Compare
const author = { author: { username: 'arthur' } }; | ||
|
||
it('should render without crushing', () => { | ||
wrapper = shallow(<CommentBox |
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 <
cc454c0
to
45195b7
Compare
}); | ||
}); | ||
it('should handle delete a comment', () => { | ||
expect( |
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.
'expect' is not defined no-undef
}); | ||
|
||
it('should handle errors on Adding new comment', () => { | ||
expect( |
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.
'expect' is not defined no-undef
|
||
return store.dispatch(removeComment('article_slug', 1)) | ||
.then(() => { | ||
expect(store.getActions()).toEqual(expectedActions); |
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.
'expect' is not defined no-undef
|
||
return store.dispatch(removeComment('article_slug', 1)) | ||
.then(() => { | ||
expect(store.getActions()).toEqual(expectedActions); |
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.
'expect' is not defined no-undef
|
||
return store.dispatch(readComments('article_slug', 1)) | ||
.then(() => { | ||
expect(store.getActions()).toEqual(expectedActions); |
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.
'expect' is not defined no-undef
|
||
return store.dispatch(readComments('article_slug', 1)) | ||
.then(() => { | ||
expect(store.getActions()).toEqual(expectedActions); |
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.
'expect' is not defined no-undef
|
||
return store.dispatch(createComment('article_slug')) | ||
.then(() => { | ||
expect(store.getActions()).toEqual(expectedActions); |
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.
'expect' is not defined no-undef
deleteComment: deleteFn, | ||
authenticatedUsername: 'arthur' | ||
}; | ||
const wrapper = mount(<DeleteComment {...props} />); |
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 <
}; | ||
|
||
it('should render without crushing', () => { | ||
wrapper = shallow(<Comment |
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 <
45195b7
to
08c9a8b
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
08c9a8b
to
38a924c
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
38a924c
to
825ca99
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
825ca99
to
46f83bb
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
deleteComment: deleteFn, | ||
authenticatedUsername: 'arthur' | ||
}; | ||
let wrapper = mount(<DeleteComment {...props} />); |
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 <
46f83bb
to
d39e052
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
d39e052
to
92856af
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
@kalsmic, Nice work with the implementation. However, as I continue to review please work on the documentation since it was the first thing that caught my eye. refer to this documentation. you can reach out to @llwasampijja as well for more insights.
src/components/Apps/App.js
Outdated
|
||
class App extends Component { | ||
render() { | ||
return ( | ||
<Router> | ||
<Switch> | ||
<Route exact path="/" render={props => <LandingPage {...props} />} /> | ||
<Route path="/comments" render={props => <Comment {...props} articleSlug="javascript-code" />} /> |
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.
Nice Work, @kalsmic , I see you are hard coded the slug, you could pass it from the URL and pick it like this: <Route path="/comments/:slug" render={props => <Comment {...props} />} />
then from your component you can then pick from
const { match } = this.props; if (match) { const { params: { slug } } = match; }
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.
Thanks, @nadralia, this is going to be removed, it is just for temporarily viewing the implementation but the Comment component is going to be attached to an article where it will receive the article slug.
92856af
to
73613b2
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
} | ||
]; | ||
|
||
export default commentTestData; |
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,5 @@ | |||
export const ADD_COMMENT_SUCCESS = 'ADD_COMMENT_SUCCESS'; |
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,99 @@ | |||
import React, { Component } from 'react'; |
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,50 @@ | |||
import React from 'react'; |
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,32 @@ | |||
// react | |||
import React, { Fragment } from 'react'; |
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,103 @@ | |||
import React from 'react'; |
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,107 @@ | |||
import React, { Component } from 'react'; |
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,25 @@ | |||
import React from 'react'; |
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,50 @@ | |||
// react | |||
import React from 'react'; |
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,54 @@ | |||
import React from 'react'; |
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'
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.
Hi @kalsmic , awesome job you have done. I would suggest you avoid using variable names which may conflict with the language keywords. An example is id, which has its own use in JSX. Also, it is not descriptive as it leaves me wondering whether you referring to the comment id, article id, or user id!
check this in CommentBox.js
73613b2
to
a42af05
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
a42af05
to
0fc6a4a
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
Thanks, @llwasampijja, I have worked on this feedback |
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
0fc6a4a
to
a752d87
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
a752d87
to
641409b
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
- add comment reducer and actions tests and implementation - add comment form [starts #165273535]
641409b
to
12e69d7
Compare
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
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.
Some files could not be reviewed due to errors:
The configured stylelint version is not supported.
The configured stylelint version is not supported. See a list of supported versions on our docs page.
What does this PR do?
Description of Task to be completed?
How should this be manually tested?
Any background context you want to provide?
What are the relevant pivotal tracker stories?
Screenshots (if appropriate)