I am working on an angular application using AngularAMD with require.js. I need to simulate a service as shown below:
module(function ($provide) {
$provide.service('ToolsService', function () {
var toolsServiceMock = {
someMethod: function () { }
};
return toolsServiceMock;
});
});
Then, I want to inject it like this:
angularAMD.inject(function ($injector) {
toolsService = $injector.get('ToolsService');
});
However, the $injector is returning the actual service instead of the mock. Additionally, it seems that the function($provide) is not being called.
When I switch from angularAMD.inject() to angular.inject(), I do get the mock but other parts of the application stop functioning properly.
Is there a way for me to instruct angularAMD to use mocks rather than real implementations?