Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Wow, some comments are three/four years old, and you did not process them? Anyway, I updated the description fixing several typos and grammar issues. Still this kata should not be approved if no effort is made to:
Also, returning "no target" is really not in line with best practice that return values should be of the same type (except for
null
orundefined
). A function that sometimes returns an array and sometimes a string is badly designed. I would suggest to review this behaviour.Could do with example tests, e.g. those from the description.
It's super unclear that your supposed to return a new array. And if you don't do it, you get a very poor error about undefined having no length property.
OR
OR
I would prefer for example, that instead of returning 'no target' it returns either the array unchanged or an empty array. In this case it's always returning an array.
you assgin doesn't
->you assign doesn't
A nice concept; well done. There was a typo in the description:
you should aware
should beyou should be aware of
, or something like that.You can use
Test.assertSimilar(result, expected, message)
to test things like objects or arrays. This will also print out a "got... expected..." message in addition to whatever message you add to it. This will also avoid running the.move()
twice.If you wanted, you could randomise the order of the tests, by sticking in the inputs in an array, and using
Test.randomize(array)
to reorder them; then loop over them and test the inputs. This will make it harder to cheat the tests. And if you want to go the whole hog, you can randomly generate tests, too.