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

prop types, tests #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

sphariab
Copy link

@sphariab sphariab commented Dec 6, 2021

No description provided.

it('should decrement amount', () => {
const wrapper = mount(<Product product={product} />);
wrapper.find('button[data-id="product-decrement"]').simulate('click');
expect(wrapper.find('[data-id="product-amount"]').text()).toBe('0');
Copy link
Owner

Choose a reason for hiding this comment

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

это тест не на decrement, а на то, что у нас кол-во не уходит в минус

PropTypes.shape({
id: PropTypes.string.isRequired,
name: PropTypes.string.isRequired,
menu: PropTypes.arrayOf(
Copy link
Owner

Choose a reason for hiding this comment

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

слишком глубоко описаны propTypes, нем тут не нужна детализация по menu и reviews

PropTypes.shape({
id: PropTypes.string.isRequired,
})).isRequired
};
Copy link
Owner

Choose a reason for hiding this comment

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

тут arrayOf тоже должен быть isRequired


it('allows us to set props', () => {
const wrapper = mount(<Reviews reviews={reviews} />);
expect(wrapper.props().reviews[0].rating).toEqual(5);
Copy link
Owner

Choose a reason for hiding this comment

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

не нужно проверять props, тем более те, которых не должно быть

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants