meteor-collection-helpers icon indicating copy to clipboard operation
meteor-collection-helpers copied to clipboard

Test collection helpers and stub them while testing other things

Open gduquesnay opened this issue 8 years ago • 2 comments

Could anyone share an example of how you are testing meteor apps that are using collection helpers. I'd like to be able to unit test some of our collection helpers and then stub those helpers when testing methods that use them.

gduquesnay avatar Jun 13 '17 22:06 gduquesnay

@gduquesnay I've never done anything too fancy, did you have a particular case where you need to stub an individual helper?

dburles avatar Jun 13 '17 23:06 dburles

Well .... our test is working right now but while writing this test I was thinking refactoring the function we are testing to move some stuff into a collection helper which we would then stub would make it easier to test.

In this case not knowing how to stub the collection helper requires us to set up much more fake data to get the test to pass.

Perhaps there's a way to save the existing helper, redefine it and then restore it after the test?

Thoughts?

gduquesnay avatar Jun 13 '17 23:06 gduquesnay