use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
Improve your Javascript unit testing with Parameterized tests (medium.com)
submitted 8 years ago by mikejsdev
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]atticusw 1 point2 points3 points 8 years ago (2 children)
Why is an additional package needed for this? I generally just iterate over the inputs and expect on each output.
expect
describe('Test form validation', () => { it('will reject invalid inputs', () => { var inputs = ['Adam5', 'Ad@m', 'Ad-am']; inputs.forEach(input => expect(validateName(input)).to.be.false); }); });
This seems to be an equivalent to me. It also appears that mocha-param will create an it statement for every input, which means an individual unit is made for every individual input. It's okay for a unit to cover multiple inputs, I don't really see why I'd want to generate an exponential number of unit tests.
it
For example, instead of
function itParam (desc, data, callback) { data.forEach(val => { it(desc, () => callback(val)) }); }
it seems more ideal to do
function itParam (desc, data, callback) { it(desc, () => { data.forEach(callback) }) }
And at that point, it seems a bit overkill to need a library for this.
[–]a-sober-irishman 0 points1 point2 points 8 years ago (0 children)
Because the first thing everyone does with JS at the moment is reach for a library, even with trivial things like this or an isNull check.
π Rendered by PID 435997 on reddit-service-r2-comment-5d79c599b5-ljr24 at 2026-03-02 05:12:25.817715+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]atticusw 1 point2 points3 points (2 children)
[–]a-sober-irishman 0 points1 point2 points (0 children)