import './index'; describe('Component vnWorkerPhones', () => { let controller; beforeEach(angular.mock.module('worker', $translateProvider => { $translateProvider.translations('en', {}); })); beforeEach(angular.mock.inject(($componentController, $rootScope) => { let $scope = $rootScope.$new(); controller = $componentController('vnWorkerPhones', $scope); controller.$scope.model = {link: 1}; controller.$scope.$applyAsync = () => {}; })); describe('setLink()', () => { it('set the link in the model and refreshes it', () => { spyOn(controller.$scope, '$applyAsync'); let value = {userFk: 106}; controller.setLink(value); expect(controller.$scope.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function)); }); }); });