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
React PropTypes Challenge Unclear #39204
Comments
I do not think the test text should just be a duplicate of the instruction. That would be redundant. Instead, we need to rewrite the text to reflect was is being tested. See below for the current testString prettified: assert((function() {
const noWhiteSpace = getUserInput('index').replace(/ /g, '');
return noWhiteSpace.includes('quantity:PropTypes.number.isRequired') && noWhiteSpace.includes('Items.propTypes=');
})()); The important part of the test is in the return statement. We are validating that we see the text "quantity:PropTypes.number.isRequired" and "Items.propTypes='" after removing whitespaces from the code. There probably is a better testString that could be written also. |
I cannot think of a more effective testString, personally. But for the test text, perhaps something like "The |
Has the same clarity issue, thanks! |
I agree that the text should be updated. I just got caught up by the unclear instructions. The way it is, I thought that what was 'required' was that quantity be a number. It doesn't suggest to me that a quantity is required. |
Opening this PR for contributions. The test text should be changed to:
|
* In React propTypes challenge, improve test text Fixes #39204 * Remove code tags around "number" Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com> Co-authored-by: Randell Dawson <5313213+RandellDawson@users.noreply.github.com>
https://www.freecodecamp.org/learn/front-end-libraries/react/use-proptypes-to-define-the-props-you-expect
In the instructions and unit tests are ambiguous with the word "required".
It states:
"The Items component should include a propTypes check that requires quantity to be a number."
This is unclear as "requires" could mean that this check just simply needs to exist for the test to pass or that quantity should be a number that is required.
I suggest either changing the above wording, or adding an additional unit test:
"The Items component should include a quantity propType that is required."
The text was updated successfully, but these errors were encountered: