101 lines
3.7 KiB
JavaScript
101 lines
3.7 KiB
JavaScript
/**
|
|
* Created by abhatkha on 5/8/17.
|
|
*/
|
|
//This is test suite for baseVO
|
|
|
|
describe("Test IncidentTemplateVO", function() {
|
|
|
|
var incidentTemplateObj;
|
|
it(" should create object ", function() {
|
|
|
|
incidentTemplateObj = new IncidentTemplateVO();
|
|
expect(incidentTemplateObj instanceof BaseVO).toEqual(true);
|
|
expect(incidentTemplateObj instanceof IncidentTemplateVO).toEqual(true);
|
|
|
|
});
|
|
|
|
it(" should initilize objects with all properties ", function() {
|
|
|
|
var incidentTemplateProp= incidentTemplateObj.getProps();
|
|
|
|
expect(incidentTemplateProp).toEqual(['id', 'createDate','name', 'type', 'desc', 'notes', 'summary', 'company', 'templateObject', 'modifiedDate']);
|
|
|
|
expect(incidentTemplateObj.id).not.toBeDefined();
|
|
expect(incidentTemplateObj.createDate).not.toBeDefined();
|
|
|
|
expect(incidentTemplateObj.name).toEqual('');
|
|
expect(incidentTemplateObj.summary).toEqual('');
|
|
expect(incidentTemplateObj.type).toEqual('');
|
|
expect(incidentTemplateObj.desc).toEqual('');
|
|
expect(incidentTemplateObj.notes).toEqual('');
|
|
expect(incidentTemplateObj.company).toBeNull();
|
|
expect(incidentTemplateObj.templateObject).toBeNull();
|
|
expect(incidentTemplateObj.modifiedDate).toBeNull();
|
|
|
|
expect(incidentTemplateObj.status ).toEqual('');
|
|
expect(incidentTemplateObj.priority ).toEqual('');
|
|
expect(incidentTemplateObj.assignedGroup).toEqual('');
|
|
expect(incidentTemplateObj.categorizations ).toEqual([]);
|
|
expect(incidentTemplateObj.resCategorizations).toEqual([]);
|
|
expect(incidentTemplateObj.allCategories ).toEqual([]);
|
|
expect(incidentTemplateObj.templateCategory ).toEqual('');
|
|
expect(incidentTemplateObj.createDateLabel ).toEqual('');
|
|
expect(incidentTemplateObj.modifiedDateLabel).toEqual('');
|
|
expect(incidentTemplateObj.tier1).toEqual('');
|
|
expect(incidentTemplateObj.tier2).toEqual('');
|
|
expect(incidentTemplateObj.tier3).toEqual('');
|
|
|
|
});
|
|
|
|
|
|
it(" should run postBuild method ", function() {
|
|
|
|
|
|
incidentTemplateObj.postBuild();
|
|
|
|
incidentTemplateObj.templateObject = {
|
|
status : '',
|
|
context : '',
|
|
priority : 'high',
|
|
type : '',
|
|
taskType : '',
|
|
supportGroup : '',
|
|
assignedGroup : {name:'P2Support'},
|
|
categorizations : [],
|
|
templateCategorizations: [{tiers:[1,2,3],incidentTemplateCategoryTier1:{}}],
|
|
resCategorizations : []
|
|
};
|
|
|
|
incidentTemplateObj.postBuild();
|
|
|
|
expect(incidentTemplateObj.type).toEqual('incidentTemplate');
|
|
expect(incidentTemplateObj.tier1).toEqual(1);
|
|
expect(incidentTemplateObj.tier2).toEqual(2);
|
|
expect(incidentTemplateObj.tier3).toEqual(3);
|
|
|
|
incidentTemplateObj.templateObject = {
|
|
status : {value:''},
|
|
context : '',
|
|
type : '',
|
|
taskType : '',
|
|
supportGroup : '',
|
|
assignedGroup : {name:'P2Support'},
|
|
categorizations : [],
|
|
templateCategorizations: [{tiers:[1,2,3],incidentTemplateCategoryTier1:{}}],
|
|
resCategorizations : []
|
|
};
|
|
|
|
incidentTemplateObj.postBuild();
|
|
|
|
expect(incidentTemplateObj.type).toEqual('incidentTemplate');
|
|
expect(incidentTemplateObj.tier1).toEqual(1);
|
|
expect(incidentTemplateObj.tier2).toEqual(2);
|
|
expect(incidentTemplateObj.tier3).toEqual(3);
|
|
|
|
expect(incidentTemplateObj.modifiedDateLabel ).toEqual('Invalid date');
|
|
|
|
expect((incidentTemplateObj.createDateLabel).indexOf('Today at')).toEqual(0);
|
|
|
|
|
|
});
|
|
}); |