describe('TicketProfileController', function () { beforeEach(module('myitsmApp')); beforeEach(inject(function ($rootScope, $controller, _events_) { this.scope = $rootScope.$new(); this.events = _events_; this.controller = $controller; this.controllerInstance = this.controller('TicketProfileController', { $scope: this.scope }); })); it('should defined', function () { expect(this.controllerInstance).toBeDefined(); }); it('should broadcast TICKET_BASIC_DATA_LOADED and assign ticket data', inject(function ($rootScope) { var data = { ticket: 'test foo' }; $rootScope.$broadcast(this.events.TICKET_BASIC_DATA_LOADED, data); expect(this.scope.ticket).toBe('test foo'); })); it('should broadcast SHOW_PROGRESS_MODAL_FOR_EDIT ', inject(function ($rootScope) { this.scope.state = { showProgressModal: {} }; var params = { title: 'test foo', text: 'test foo1', cssClass: {}, showModal: {} }; $rootScope.$broadcast(this.events.SHOW_PROGRESS_MODAL_FOR_EDIT, params); expect(this.scope.progress.title).toBe('test foo'); })); it('should broadcast SELECT_RESOURCE_TAB ', inject(function ($rootScope) { this.scope.state = { resourceTabActive: false }; $rootScope.$broadcast(this.events.SELECT_RESOURCE_TAB); expect(this.scope.state.resourceTabActive).toBe(true); })); it('should broadcast REFRESH_TICKET ', inject(function ($rootScope) { $rootScope.$broadcast(this.events.REFRESH_TICKET); })); });