Controller
function SomeController(someService) { const $ctrl = this; activate(); function activate() { someService.retrieveSomeData($ctrl.criteria).then(doSomething); } function doSomething(response) { $ctrl.result = response.data; } }
Test
describe('SomeController', () => { beforeEach(module('myModule')); let $controller; beforeEach(inject((_$controller_,) => { $controller = _$controller_; })); it('tests $controller properties', () => { const $scope = {}; const controller = $controller('SomeController', { $scope }); }); });
Here I want to sent $ctrl.criteria
while initializing my controller so I can test $ctrl.result
afterwards. As you can, activate() method is fired upon initialization, so I can't set criteria after initialization.