SmartIT_Extensions/BMC/smart-it-full/test/app/service-request/service-request-vo.spec.js

34 lines
2.0 KiB
JavaScript

/*** Created by npatil2 .*/
describe('ServiceRequestVO', function () {
var serviceRequestVO;
it(' should do object creation ', function () {
serviceRequestVO = new ServiceRequestVO();
expect(serviceRequestVO instanceof BaseVO).toEqual(true);
expect(serviceRequestVO instanceof ServiceRequestVO).toEqual(true);
});
it('should do object initilization ', function () {
this.serviceRequestProps = serviceRequestVO.getProps();
expect(this.serviceRequestProps).toEqual(['id', 'createDate', 'displayId', 'modifiedDate', 'summary', 'priority', 'desc', 'numAttachments', 'status', 'assignee', 'supportGroup', 'serviceTargets', 'customer', 'contact', 'categorizations', 'customFields', 'dynamicFields', 'following', 'accessMappings', 'company', 'locationCompany', 'ownerGroup', 'quantity', 'price', 'expectedDate', 'requiredDate', 'isCrossLaunchRequest', 'isCrossLaunchSubmitted', 'crossLaunchURL', 'crossLaunchURLDisplay', 'crossLaunchURLCreate', 'requestTemplateTitle', 'requestTemplateId', 'questionDefinitions', 'conditionalQuestions', 'questionResponses', 'currency', 'instructions', 'approvalSummaries', 'hideAttributes', 'accessMappings', 'completionDate']);
serviceRequestVO.hideAttributes = true;
this.serviceRequestpostBuild = serviceRequestVO.postBuild();
expect(serviceRequestVO.accessMappings.detailsEditAllowed).toBe(false);
expect(serviceRequestVO.accessMappings.statusEditAllowed).toBe(true);
expect(serviceRequestVO.accessMappings.timelineEditAllowed).toBe(true);
expect(serviceRequestVO.accessMappings.relationsEditAllowed).toBe(false);
serviceRequestVO.accessMappings = [{
id: '12344',
detailsEditAllowed: true,
statusEditAllowed: false,
timelineEditAllowed: false,
relationsEditAllowed: false
}];
this.serviceRequestpostBuild = serviceRequestVO.postBuild();
expect(serviceRequestVO.accessMappings['12344EditAllowed']).toBe(false);
});
});