Exitos
Exitos

Reputation: 29750

How can I make this test pass in Jasmine?

I have a Jasmine unit test and in it I have this 'expect'...

       expect(mockService.create).toHaveBeenCalledWith(new ToDoItem('[email protected]', 'get milk'));

In my controller I have the following...

        todoService.create($scope.newToDo, 
           function() {

        }, function() {

        });

But I always get an error because of the final two functions that I pass the service for success and failure. How can I stop this from happening? How do I add them to the expect clause?

Thanks

Upvotes: 0

Views: 917

Answers (1)

Jason Baker
Jason Baker

Reputation: 2483

You may be able to use jasmine.any(Function), or jasmine.objectContaining.

Fair warning, I've never done this myself. However, from the documentation, at least one of them should provide the behaviour you want.

Upvotes: 2

Related Questions