anticoders / gagarin

Another testing framework for your meteor apps.
gagarin.meteor.com
MIT License
150 stars 21 forks source link

SpyOn support? #144

Closed bitomule closed 3 years ago

bitomule commented 8 years ago

I'm moving from jasmine + velocity to gagarin but not sure how to do spyOn with gagarin. Any idea?

apendua commented 8 years ago

@bitomule Can you provide some example test in which you're planning to use Gagarin along with spyOn?

bitomule commented 8 years ago

@apendua I use it when I need to check some method is called and also to return a fake response from that method. For example, a method that calls stripe api.

How should I do that with gagarin?

apendua commented 8 years ago

@bitomule The problem here is that when you execute some code with

server.execute(...);
client.execute(...);

it is run in the respective environment (client or server) so not really in your current node process. I understand that spyOn makes most sense if you use it either on server or client, so you will need to make sure that the library is available in those environments, probabbly by creating a custom debugOnly package and including it in your meteor project manually. I don't see any easier solution at the moment.