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.
From the instructions:
In the instructions, it states that the
getChunk
function exposed by the reader "Returns at least one char".One of the test cases, the first chunk received by the parse method is an empty string (so the entire string it was reading must be an empty string), thus making the charCount, wordCount, and lineCount expected to be 0.
Even if it was allowed that the first string received by
getChunk
was an empty string, there are other tests where there are empty lines that count as a line, so wouldn't an empty string test case still have alineCount
of 1?Example:
and if that's the case, then shouldn't this be true:
Thank you for the reply. :)
Will revise my code
You're not supposed to give a
reader
argument toDocumentParser.prototype.parse
. You're supposed to call thegetChunk()
method from thereader
instance that is already provided to the constructor of theDocumentParser
object.So you can perform these changes :
And then you can implement and test your solution.
(I let the issue open since it's a strange behavior and most likely truly a bug...)
Is this a bug or did I just misunderstood something?
I tried to console.log the output within parse() and it seems like I get correct char, word, and line counts (on the initial test case: "Once upon a time")
This error shows upon Test (not on submit)
Appreciate any feedback :)