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.
Enabled in this fork
Could you kindly stop cheating now?
This comment is hidden because it contains spoiler information about the solution
Oh please do not get me wrong, I am not trying to say that this particular kata or translation is bad for this reason, or that someone did it wrong. Absolutely not! When I update tests from Node 8 to Node 18, I usually do not change the structure of test cases either, because it would make updates much slower. We just have to work with whatever practices and patters have been established over the years :)
I like explicitly organized fixed tests and example tests, because after all, each fixed test is usually meant to test a specific thing. But it's not what we have now, and current consensus is different whether we like it or not. All we can do is to promote the idea of organized fixed tests and see if it gets any attention :)
Yeah this answers my question, though I think it is useful to show passed assertions so that you can progressivly work on solution, also for console.log-ing its good to see logs per assertion not all at once till solution fails..
Looking at the revisions page, I am the one who upgraded the JS version to Node 18 + chai (in 2022). I completely agree it's not the best, and ideally more
it()blocks makes for a nicer user experience, like a better granularity, a clearer picture of what their solution already handles correctly and what it does not.However such test suites require more effort and time to write, and usually when upgrading I'm just content with just using
chai, providing better assertion messages, upgrading the initial code to use more modern features (such as classes instead of the olden function-based constructors). There is a tradeoff between the number of kata to upgrade and the amount of effort one can spend on each one to make it as good as possible.Before my upgrade, the assertions were written
Test.expect(customCompareArrays(spiralize(i), spiralize_good(i)));, so even with the sample tests lumped together i believe the current version is better.Well, to be honest, I do not like when fixed tests are lumped into a single
iteither 🤷♂️I think the OP is confused by the fact that the output panel will show "Passed: 0" even though their code passes the first assertion. This is because in the mocha + chai Codewars setup, "Passed" counts the number of
it()blocks in which all assertions were successful. Since all the sample tests for this kata are in the sameit(), the "passed" counter will always be at 0 until the user's code is correct.This is how tests in this kata are set up: they do not show passed tests, because it's not really relevant. They show only
nfor which you failed.no, this is something I saved with an intention to work on it later, if you write to make it work for lets say n5 it will not show n5 as passed but show failed for n6 for example..
Your solution has a bug. Here is what it returns for n=8:
And for n=19:
It is not. We do not know what language, we do not know the failing code, it is not really clear what " it always at 0" means. I have literally zero idea what I should check to recreate your problem and start fixing it.
Issue is already explained "Explicitly".
Explain the issue more explicitly.
There is an issue with passing test, it always at 0 unless all tests are passed.
Loading more items...