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

Need additional test case #1423

Closed
JayWIlsonJr opened this issue Jul 31, 2015 · 2 comments
Closed

Need additional test case #1423

JayWIlsonJr opened this issue Jul 31, 2015 · 2 comments

Comments

@JayWIlsonJr
Copy link

Challenge http://www.freecodecamp.com/challenges/bonfire-where-art-thou has an issue. Please describe how to reproduce it, and include links to screen shots if possible.

I was able to hardcode the value to make the test pass. I think there should be a test written to test against this possible scenario. See my code below:

function where(collection, source) {
  var arr = [];
  // What's in a name?
  arr = collection.filter(function(item) {
    return item.last === source.last;
  });
  return arr;
}

where([{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }], { last: 'Capulet' });
@kurzninja
Copy link
Contributor

I'm not sure if there is a way to test against this scenario. The test cases are only checking for the proper output in ALL of the bonfires, they aren't testing how you got to that output.

As for your code, I'm not sure how you consider that "hardcoding" the answer, you're just generating the answer using functional programming technique. This isn't the intended way of solving this bonfire, but it's certainly a valid method, especially once you pass the Functional Programming waypoint and go back and redo the bonfires using those techniques like some of us have.

Please correct me if I'm wrong.

@benschenker
Copy link
Contributor

Closing this issue as stale, please reopen if you deem it unresolved

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

No branches or pull requests

3 participants