Returning empty array for empty timetable makes no sense whatsoever. It should return empty string.
Test cases starting from the 5th are vulnerable to input modification.
I passed all tests, but have the error:
TypeError: d.toUpperCase is not a function
Can you help with this issue?
This kata was challenging for me, but I enjoyed it very much and learned a lot. Also, I think this one was very well crafted. A complex problem to solve, but not because it was hard to figure out what the problem was asking for. Well done.
Ah, okay. Strictly, the wording is correct, but it's easily misread. Maybe some tweaking of the wording would help? But re-reading it, it makes sense.
It shouldn't be concatinated because working days will be only Monday and Friday not all days from Monday to Friday.
And seems that you've put logic for this right here: if ... (last.order === d.order - 1), please correct me if I'm wrong.
if ... (last.order === d.order - 1)
Thank for notice about empty array, probably null will be better.
"You may be given an array only of Monday and Friday with the same hours, but they shouldn't be concatenated." --Why? And what about such a situation should mean nothing would be concatenated? I haven't put any logic in that handles this, and it passed just fine.
"If the array is empty, it just returns an empty array." --Seems strange to return a different format type (other than something like null). I would've thought we'd return an empty string, as if it were a blank sign for the working hours.
No problems, thank you a lot!
Fixed a few things for you, hope you don't mind. Your results and expected results were in the wrong order (you were saying "expected: [the user's solution], instead got: [actual answer]"), added Test.describe() to random tests (not to fixed tests due to formatting issues), protected the random tests from input modification and bumped number of random tests from 20 to 100, which is standard :)
You might want to add variation to the times in the random tests though, as @ZED_CWT loves to hardcode whenever he can get away with it ;)
(He only does it to point out weaknesses in the test, but the point is well-made).
Thanks for feedback, BTW it's my first kata :)
^This.. and also, assertEquals is preferable to assertSimilar because it's already a string so we don't need it and it's a bit more readable (fewer escapes).
The second test in the sample tests expects a trailing '\n'.
BTW: processData(data) are the most generic function and argument names I've ever seen. How about readableTimetable(workdays)?