SmartIT_Extensions/BMC/smart-it-full/test/app/common/url-creator-service.spec.js

39 lines
1.4 KiB
JavaScript

/*** Created by npatil2 .*/
describe('service: urlCreatorService', function () {
var $httpBackend;
beforeEach(module('myitsmApp'));
beforeEach(inject(function ($injector, $location) {
this.$location = $location;
$httpBackend = $injector.get('$httpBackend');
$httpBackend.whenGET('scripts/app/i18n/resources-locale_en-US.json').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);
$rootScope = $injector.get('$rootScope');
this.urlCreatorService = $injector.get('urlCreatorService');
}));
it('should defined', function () {
expect(this.urlCreatorService).toBeDefined();
});
it('should run create ()', function () {
this.entity = {
ticketType: 'asset',
reconciliationId: true,
classId: 1233
};
this.myResult = this.urlCreatorService.create(this.entity);
expect(this.myResult).toBe('/http://server/asset/true/1233');
this.entity = {
reconciliationId: true,
classId: 1233
};
this.myResult = this.urlCreatorService.create(this.entity);
expect(this.myResult).toBe('/http://server/undefined/undefined');
});
});