Skip to content
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

#161348759 Rating an article #16

Merged
merged 1 commit into from
Dec 18, 2018
Merged

Conversation

judeinno
Copy link

@judeinno judeinno commented Dec 8, 2018

What does this PR do?

  • A user is able to see the rating of an article and also rate the article.

Description of Task to be completed?

  • Add radio buttons for the user to be able to rate an article.
  • Add 5-star rating to show the article rating.

How should this be manually tested?

  • Click any rating on the radio buttons and click submit.
  • The when a user gets an article by ID the rating is returned in 5-star rating format.

What are the relevant pivotal tracker stories?

#161348759

Screenshots

image

@judeinno judeinno added the still in progress Still being worked on label Dec 8, 2018
const initalState = {
};

const ratingReducer = (state = initalState, action) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

});
});

describe('<Rating />', () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

expect(ratingReducer(initalState, action)).toEqual(expectedData);
});

test('test rating post data succesfully', () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

expect(ratingReducer(initalState, action)).toEqual(expectedData);
});

test('test rating post succesfully', () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

const headers = {
headers: { Authorization: token },
};
return axios.post(url, data, headers)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical blocks of code found in 2 locations. Consider refactoring.

payload: rate,
});

export const fetchRatingThunk = () => dispatch => axios.get('https://ah-backend-thanos-staging.herokuapp.com/api/articles/7')
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identical blocks of code found in 2 locations. Consider refactoring.

type: ACTION_TYPE.GET_RATING_SUCCESS,
}];
const store = mockStore({});
store.dispatch(fetchRatingThunk()).then(() => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 3 locations. Consider refactoring.

payload: { message: 'ok' },
}];
const store = mockStore({});
store.dispatch(postRating()).then(() => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 3 locations. Consider refactoring.

// import and pass your custom axios instance to this method
moxios.uninstall();
});
test('Successful get rating action', () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

payload: rate,
}));
});
test('successfull post rating action', () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@judeinno judeinno force-pushed the ft-rating-article-161348759 branch 8 times, most recently from c1a233f to d646cd1 Compare December 9, 2018 08:22
};

const mockStore = configureMockStore([thunk]);
const LoginComponent = shallow(<Login onChange={jest.fn()} onSubmit={jest.fn()} />);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.


describe('<Rating />', () => {
test('renders the component', () => {
const RatingComponent = shallow(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@judeinno judeinno force-pushed the ft-rating-article-161348759 branch 6 times, most recently from 70058d9 to 0cfd840 Compare December 10, 2018 08:29
@judeinno judeinno added ready ready for merging and removed still in progress Still being worked on labels Dec 10, 2018
Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 15976 lines exceeds the maximum allowed for the inline comments feature.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 15993 lines exceeds the maximum allowed for the inline comments feature.

brucemakallan
brucemakallan previously approved these changes Dec 17, 2018
Copy link
Collaborator

@brucemakallan brucemakallan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing the tests and code climate issues. Looks good.

RachaelNantale
RachaelNantale previously approved these changes Dec 17, 2018
Copy link
Contributor

@RachaelNantale RachaelNantale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good, The UI is well implemented

dnuwa
dnuwa previously approved these changes Dec 17, 2018
Sulaiman-Mozes
Sulaiman-Mozes previously approved these changes Dec 17, 2018
@judeinno judeinno force-pushed the ft-rating-article-161348759 branch 3 times, most recently from dda685a to 9345bd1 Compare December 18, 2018 09:10
));
});
});
test('get rate successfull', () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

));
});
});
test('get rate Failed', () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar blocks of code found in 2 locations. Consider refactoring.

@judeinno judeinno force-pushed the ft-rating-article-161348759 branch 6 times, most recently from bbab163 to 3383e6e Compare December 18, 2018 11:36
Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 15078 lines exceeds the maximum allowed for the inline comments feature.

- Add 5 star rating for a single article
- Add radio buttons for a user to rate an article.

[#161348759]
Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 15079 lines exceeds the maximum allowed for the inline comments feature.

@codeclimate
Copy link

codeclimate bot commented Dec 18, 2018

Code Climate has analyzed commit 1796c96 and detected 0 issues on this pull request.

View more on Code Climate.

@tibetegya tibetegya merged commit 337bbac into develop Dec 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready ready for merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants