describe("RelatePeopleController", function () { var modalInstance; beforeEach(module('myitsmApp', 'assetModule', 'adminModule')); beforeEach(inject(function ($rootScope, $controller, events) { this.scope = $rootScope.$new(); this.events = events; modalInstance = { // Create a mock object using spies close: jasmine.createSpy('modalInstance.close'), dismiss: jasmine.createSpy('modalInstance.dismiss'), result: { then: jasmine.createSpy('modalInstance.result.then') } }; this.createController = function () { return $controller('RelatePeopleController', { $scope: this.scope, $modalInstance: modalInstance }); }; this.controller = this.createController(); })); it('should defined', function () { expect(this.controller).toBeDefined(); }); it('should broadcast DISCARD_CHANGES and assign asste data', inject(function ($rootScope) { $rootScope.$broadcast(this.events.MODAL_BACKDROP_CLICK); })); });