/***Created by vdhakre***/ describe('Testing relationService', function () { 'use strict'; var relationService, $resource, $httpBackend, basicData, relations; beforeEach(module('myitsmApp')); beforeEach(inject(function (_relationService_, _$resource_, _$httpBackend_) { relationService = _relationService_; $resource = _$resource_; $httpBackend = _$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/sessionstatus?getLicenseKey=true').respond(''); $httpBackend.whenGET('/smartit/rest/serverstates').respond(''); basicData = { "type": "incident", "resolvedDate": null, "impactedService": null, "causalCI": null, "impact": "4-Minor/Localized", "id": "IDGAA5V0HI2QLAPEEZ9WPDI7IBAAMD" }; relations = [ { "desc": "Allen Allbrook ", "displayId": "INC000000000016", "parentId": "IDGAA5V0HI2QLAPEEZ9WPDI7IBAAMD", "relationshipType": "resolved", "tag": "linkeditem", "type": "incident", "templateName": "", "visited": false, "subType": "", "id": "IDGAA5V0HI2QLAPBRQIJPAV02I7FQT", "isPoi": false } ]; })); it('should exist', function () { expect(relationService).toBeDefined(); }); it('should execute getRelatedLinkedItems with causalCI and impactedService as a null value', function () { var results = null; results = relationService.getRelatedLinkedItems(relations, basicData, false); expect(results[0].id).toEqual(relations[0].id); }); });