I am writing a specification that verifies that a method is called during the configuration phase of the Angular module under test.
Here's a simplified look at the code under test:
angular.module('core',['services.configAction'])
.config(function(configAction){
configAction.deferIntercept(true);
});
What happens above, we define a module corethat has one dependency.
Then, in the configmodule block, corewe call the method deferInterceptfor the object configActionspecified for use from services.configAction.
I am trying to verify that this coreconfig calls this method.
This is the current setting:
describe('core',function()
{
const configActionProvider={
deferIntercept:jasmine.createSpy('deferIntercept'),
$get:function(){
return {}
}
};
beforeEach(function()
{
module(function($provide)
{
$provide.provider('configAction',configActionProvider);
});
module('core.AppInitializer');
inject(function($injector)
{
});
});
it('should call deferIntercept',function()
{
expect(configActionProvider.deferIntercept).toHaveBeenCalledWith(true);
});
});
, configAction, , -.
, core, angular.module('core',[]) angular.module('core',['services.configAction']) spy.
services.configAction , ?