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.
No random tests
JS Node 18. with
chai
framework should be usedreusability/purity is not specified/tested: what should happen for a test like this ?
Nice idea but no random tests.
Approved
The syntax for expectError is different, and you had the test always expecting errors. That won't discriminate between lazy (no error) and eager (error) of course. The test was testing for its own incorrect syntax, and always passing. :P
I fixed the test; have a look at it. You give a function that throws an error as the argument, so you wrap the user solution in a dummy function. Unfortunately, I haven't been able to figure out how to give a message when the test fails, and the docs are out of date on this. So there is only the default error message when failing the test.
But at least it should now work as intended. :]
Thanks I couldn't think of a proper way to check for laziness. I believe it checks for it now, but let me know if you see any more issues. Thanks again for the feedback.
You're still not testing for the laziness of the solution.
ATM, all you need to do is parse an awkward alternate syntax of standard JS methods. There need be no thunking involved. See my solution. (The last one, with the Eager class.)
The way to test this, of course, is invoke some method that will run forever if evaluated, and then test without invoking
value
.The issue should be fixed, you could say I was being lazy with my testing.
Laziness should really be tested. My eager solution passes.