describe("RelateAssetController", function () { var modalInstance, linkParams; beforeEach(module('myitsmApp')); beforeEach(inject(function ($rootScope, $controller, events) { this.scope = $rootScope.$new(); this.events = events; linkParams = { result: { then: jasmine.createSpy('modalInstance.result.then') } }; 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('RelateAssetController', { $scope: this.scope, $modalInstance: modalInstance, linkParams: linkParams }); }; this.controller = this.createController(); })); it('should defined', function () { expect(this.controller).toBeDefined(); }); it('should broadcast MODAL_BACKDROP_CLICK and assign asste data', inject(function ($rootScope) { $rootScope.$broadcast(this.events.MODAL_BACKDROP_CLICK); })); });