SmartIT_Extensions/BMC/smart-it-full/test/app/asset/asset-profile-controller.sp...

43 lines
1.5 KiB
JavaScript

/*** Created by npatil2 .*/
describe('AssetProfileController', function () {
beforeEach(module('myitsmApp'));
beforeEach(inject(function ($rootScope, $controller, events, $state) {
this.scope = $rootScope.$new();
this.controller = $controller;
this.events = events;
this.$state = $state;
this.controllerInstance = this.controller('AssetProfileController', {
$scope: this.scope
});
}));
beforeEach(inject(function ($injector) {
$httpBackend = $injector.get('$httpBackend');
var getLocale = function () {
return readJSON('scripts/app/i18n/resources-locale_en.json');
};
$httpBackend.whenGET(/^scripts\/app\/i18n\/resources-locale_en.*$/).respond(getLocale());
$httpBackend.whenGET('/smartit/rest/v2/metadata?type=global').respond(200);
$httpBackend.whenGET('/smartit/rest/serverstates').respond(200);
$httpBackend.whenGET('/smartit/rest/sessionstatus?getLicenseKey=true').respond(200);
$httpBackend.whenGET('views/dashboard/index.html').respond(200);
}));
it('should defined', function () {
expect(this.controllerInstance).toBeDefined();
});
it('should broadcast ASSET_DETAILS_LOADED and assign asste data', inject(function ($rootScope) {
var data = {
asset: 'test foo'
};
$e = document.createEvent('Event');
$rootScope.$broadcast(this.events.ASSET_DETAILS_LOADED, data, $e);
expect(this.scope.asset).toEqual('test foo');
}));
});