36 lines
1.7 KiB
JavaScript
36 lines
1.7 KiB
JavaScript
/*** Created by npatil2 */
|
|
describe('service: layoutConfigurationService', function () {
|
|
var $httpBackend, $rootScope, scope;
|
|
|
|
beforeEach(module('myitsmApp'));
|
|
beforeEach(inject(function ($injector, $http, $q) {
|
|
$httpBackend = $injector.get('$httpBackend');
|
|
var getLocale = function () {
|
|
return readJSON('scripts/app/i18n/resources-locale_en.json');
|
|
};
|
|
|
|
$httpBackend.when('POST', '/smartit/rest/customization/save/layout').respond(200);
|
|
$httpBackend.when('POST', '/smartit/rest/customization/save/layout?screen=test+screen').respond(200);
|
|
$httpBackend.whenGET(/^scripts\/app\/i18n\/resources-locale_en.*$/).respond(getLocale());
|
|
$httpBackend.whenGET('/smartit/rest/v2/customization/screenlayout').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);
|
|
$httpBackend.whenGET('/smartit/rest/v2/customization/screenlayout?data=test').respond(200);
|
|
|
|
$rootScope = $injector.get('$rootScope');
|
|
this.layoutConfigurationService = $injector.get('layoutConfigurationService');
|
|
}));
|
|
|
|
it('should run loadLayout and updateScreenLayout () ', function () {
|
|
var params = {
|
|
data: 'test'
|
|
}, screenName = 'test screen', layout = 'test layout';
|
|
|
|
this.myResult = this.layoutConfigurationService.loadLayout(params);
|
|
expect(this.myResult.$$state.status).toEqual(0);
|
|
this.myResult = this.layoutConfigurationService.updateScreenLayout(screenName, layout);
|
|
expect(this.myResult.$$state.status).toEqual(0);
|
|
$httpBackend.flush();
|
|
});
|
|
}); |