I would argue that testing constructor that only assigns private initial value is unnecessary, seeing how you're testing methods that work with that value. After all, it doesn't matter what's going on inside a class if the output is correct.
You have a point. I've mentioned in the article, maybe if the constructor function has some logic, it can be tested and asserted as well. But true that, in the example I've given, testing the constructor itself might not mean that much, just putting it there.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I would argue that testing constructor that only assigns private initial value is unnecessary, seeing how you're testing methods that work with that value. After all, it doesn't matter what's going on inside a class if the output is correct.
You have a point. I've mentioned in the article, maybe if the constructor function has some logic, it can be tested and asserted as well. But true that, in the example I've given, testing the constructor itself might not mean that much, just putting it there.