SmartIT_Extensions/BMC/smart-it-full/test/app/common/vo/ticket-vo.spec.js

63 lines
2.1 KiB
JavaScript

/**
* Created by abhatkha on 5/8/17.
*/
//This is test suite for baseVO
describe("Test TicketVO", function() {
var ticketObj
it("TicketVO object creation ", function() {
ticketObj = new TicketVO();
expect(ticketObj instanceof BaseVO).toEqual(true);
expect(ticketObj instanceof TicketVO).toEqual(true);
});
it("TicketVO object initilization ", function() {
var ticketeProp= ticketObj.getProps();
expect(ticketeProp).toEqual([ 'id', 'createDate', 'displayId', 'modifiedDate', 'summary', 'priority', 'desc', 'numAttachments', 'status', 'assignee', 'supportGroup', 'serviceTargets', 'customer', 'contact', 'categorizations', 'customFields', 'dynamicFields', 'following', 'accessMappings', 'company', 'locationCompany', 'ownerGroup' ]);
expect(ticketObj.id).not.toBeDefined();
expect(ticketObj.createDate).not.toBeDefined();
expect(ticketObj.priority).toEqual('');
expect(ticketObj.summary).toEqual('');
expect(ticketObj.desc).toEqual('');
expect(ticketObj.type).toEqual('');
expect(ticketObj.status).toEqual({ });
expect(ticketObj.customer).toBeNull();
expect(ticketObj.dynamicFields).toEqual([ ]);
});
it("TicketVO object status methods ", function() {
expect(ticketObj.isOngoing()).toBeTruthy();
expect(ticketObj.isPaused()).toBeFalsy();
expect(ticketObj.isResolved()).toBeFalsy();
expect(ticketObj.isCancelled()).toBeFalsy();
expect(ticketObj.isClosed()).toBeFalsy();
});
it("TicketVO object postBuild method ", function() {
ticketObj.dynamicFields.push({name:'test',value: 1});
ticketObj.postBuild();
expect(ticketObj.accessMappings.detailsEditAllowed).toBeTruthy();
expect(ticketObj.accessMappings.tasksEditAllowed).toBeTruthy();
expect(ticketObj.dynamicFields[0].editable).toBeTruthy();
expect(ticketObj.dynamicFields[0].isDynamic).toBeTruthy();
ticketObj.customer= { company: ''};
ticketObj.postBuild();
expect(ticketObj.accessMappings).toEqual({ });
expect(ticketObj.company).not.toBeNull();
});
});