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

05 Challenge has confusing error #26

Closed
carver opened this issue Jul 1, 2015 · 1 comment
Closed

05 Challenge has confusing error #26

carver opened this issue Jul 1, 2015 · 1 comment

Comments

@carver
Copy link

carver commented Jul 1, 2015

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?

@voter101
Copy link
Contributor

voter101 commented Jul 1, 2015

Hey there!

There's already an issue for that: #4

We will take care of that, thanks for pointing exact place in code.

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

No branches or pull requests

2 participants