Unit test for dummies


Hi guys,

I’ve started looking at how to unit test my app but I can’t seem to wrap my head around it.

Say I have a controller that what it does is getting data from cache and pass it to scope ? What would be a unit test for this controller ?

Say I have different services injected, I keep getting on Karma “unknown provider” on the services. How to overcome this ?

Can’t seem to find a unit test for dummies tutorial on the web…


Have you tried this tutorial:
http://mcgivery.com/unit-testing-ionic-app/ ?


I tried but, for example, if I try to test my controller (which has some dependencies from other services), it says known provider.

Just thought about it now, could it be that it’s because I need to initialise the module for those services also ?


You could download an open source ionic project, or one of the extensive examples, and just play around with it until you understand it further.

Much more effective than following an intro tutorial IMO. Or you might want to look into Appium