createSpyObj requires a non-empty array

Error while running ng test with karma:

createSpyObj requires a non-empty array or object of 
method names to create spies for thrown


The problem could be that you are creating a spy object like this:



jasmine.createSpyObj('YourService', [])

Solution is to pass the method names to your SpyObj constructor. Here is an example on how to dop that:

jasmine.createSpyObj('YourService', ['method1', 'method2']) 

Above, the second argument of the createSpyObj is the array of methods you want to be spied.