Question on an example: const validate = (param) => { if (condition) throw err1 else throw err2 } const fn = (param1, param2) => { validate(param1); do some other stuff... } If I unit test the validate function should test the behaviour of validate function inside of fn function? Is this a problem with how I design this code , maybe ?
Could it be that you "frequently" end up with three items under each node in your tree because of an affinity for Arrange (generate seed), Act (replace world), Assert (output world)?
+David Moody yes, I do, but nothing worth sharing publicly at the moment. I have a screencast of a recent talk that I'll be posting but I'm waiting on audio & video feeds from the venue
@@nohaiionut5698 Four years later, and I think this is probably the video I was referring to blog.testdouble.com/talks/2016-06-05-happier-tdd-with-testdouble-js/
+David Moody The short answer is that testing approaches like this one are a big reason why dependency injection itself took off in the Java community with Spring. Without dependency injection of some sort, you may need to resort to bytecode manipulation (see PowerMock) which is incredibly slow and roundabout.
Guys, there is a course by Justin Searls on frontend masters !
Question on an example:
const validate = (param) => {
if (condition) throw err1
else throw err2
}
const fn = (param1, param2) => {
validate(param1);
do some other stuff...
}
If I unit test the validate function should test the behaviour of validate function inside of fn function?
Is this a problem with how I design this code , maybe ?
Could it be that you "frequently" end up with three items under each node in your tree because of an affinity for Arrange (generate seed), Act (replace world), Assert (output world)?
this is incredibly useful. do you have this sort of walk throughout using JS?
+David Moody yes, I do, but nothing worth sharing publicly at the moment. I have a screencast of a recent talk that I'll be posting but I'm waiting on audio & video feeds from the venue
@@JustinSearls Are you still waiting for audio and video ? Would be ok without video and audio if not.
@@nohaiionut5698 Four years later, and I think this is probably the video I was referring to blog.testdouble.com/talks/2016-06-05-happier-tdd-with-testdouble-js/
how does this work when you are not injecting the mocks into your subject?
+David Moody The short answer is that testing approaches like this one are a big reason why dependency injection itself took off in the Java community with Spring. Without dependency injection of some sort, you may need to resort to bytecode manipulation (see PowerMock) which is incredibly slow and roundabout.