AShkANRed
AShkANRed

Reputation: 51

Angular Component is Undefined in Jasmine Test

Please help.

I think I defined test configs right.

But this throws Provider error for LayoutService.

This is my test code

This is the error

Upvotes: 0

Views: 927

Answers (1)

Oleksii Nuzhyn
Oleksii Nuzhyn

Reputation: 91

createSpyObj has the following description from the Jasmine documentation:

createSpyObj(baseName, methodNames, propertyNames)

The method takes as arguments the name of the Service to be mocked, and the second argument is an array of all the methods inside that class that needs to be mocked.

You should pass to your spy object the original service name and methods that are used by your code.

spyLayoutService = jasmine.createSpyObj('CsLayoutService', ['...'])

Upvotes: 1

Related Questions