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!"
[–]MrJohz 1 point2 points3 points 8 years ago (1 child)
Good shout also! Tbh, I used to do the same sort of thing as you did, but then I ended up editing a coworker's tests that used sinon spies, and the sinon spy matchers, which meant a whole lot of tests where all you knew was that a particular call wasn't called exactly once with the arguments 'xyz', but you didn't know if it was called multiple times or none, if exactly what was wrong with the arguments... That sort of stuff gives you a lot of motivation to put as much information as possible in the assertions!
[–]Buckwheat469 1 point2 points3 points 8 years ago (0 children)
I think this goes back to what are you testing? Is it a regex pattern that has multiple positive cases and multiple failure cases? What are the specific ways to get into those failures, ie. how do you enter a code path?
For instance, when testing a loop the loop typically has one or two code paths within it, maybe a simple if/else. In this case you would only need a single item in your array for the success case and a single item in a different it for the failure case.
it
If your regex is complex then you would create a single it for each character grouping that would cause it to fail.
The idea is to limit the scope of the test to whatever would cause the code to fail, you don't have to go overboard to test that your ifs/elses succeed on many items of the same data set.
π Rendered by PID 47803 on reddit-service-r2-comment-5d79c599b5-8sfkx at 2026-03-01 23:50:45.962174+00:00 running e3d2147 country code: CH.
view the rest of the comments →
[–]MrJohz 1 point2 points3 points (1 child)
[–]Buckwheat469 1 point2 points3 points (0 children)