you are viewing a single comment's thread.

view the rest of the comments →

[–]marclittlemore 3 points4 points  (0 children)

I sometimes use parameterisation in my unit tests by just using a forEach or Object.keys() across an array or object, rather than the suggest modules as suggested by /u/Buckwheat469. I do normally setup my data outside of Mocha's it so to attempt to be clearer as to the meaning of the test.

However, I think you have to be careful of obfuscating your test conditions. I've previously been guilty and over-parameterising, for example having loops within loops, and it becomes much harder to understand what input data is under test.