You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing "Apples" in my list, but the test is failing with "GroceriesListItem should display a grocery name".
Changing the test in this way results in a passing test:
- assert.equal(groceryItem.props.children, "Apples", "GroceriesListItem should display a grocery name");
+ let children = groceryItem.props.children;
+ assert.equal(React.Children.count(children), 1, "GroceriesListItem should contain one child element");
+ let expected = "Apples";
+ React.Children.forEach(children, function (c) { if (c != expected) { throw new Error("GroceriesListItem should display only: "+expected+" not "+c); }});
I'm going to assume that my code is broken instead of the test, since I'm new to React. Can someone help me improve this test so people can understand what's actually wrong?
The text was updated successfully, but these errors were encountered:
I'm seeing "Apples" in my list, but the test is failing with "GroceriesListItem should display a grocery name".
Changing the test in this way results in a passing test:
I'm going to assume that my code is broken instead of the test, since I'm new to React. Can someone help me improve this test so people can understand what's actually wrong?
The text was updated successfully, but these errors were encountered: