76 lines
2.0 KiB
JavaScript
76 lines
2.0 KiB
JavaScript
/**
|
|
* Created by mkumar1 on 09-05-2017.
|
|
*/
|
|
|
|
describe('Testing SLA VO', function () {
|
|
|
|
var slaVo;
|
|
var spyObj = null;
|
|
|
|
function setIcons() {
|
|
slaVo = new SLAVO();
|
|
|
|
slaVo.processIconClass();
|
|
expect(slaVo.iconClass).toEqual('circle_o');
|
|
|
|
slaVo.measurementStatus = SLAVO.MEASUREMENT_STATUS_MET;
|
|
slaVo.processIconClass();
|
|
expect(slaVo.iconClass).toEqual('check_circle_o');
|
|
|
|
slaVo.measurementStatus = SLAVO.MEASUREMENT_STATUS_MISSED;
|
|
slaVo.processIconClass();
|
|
expect(slaVo.iconClass).toEqual('cross_circle_o');
|
|
|
|
slaVo.measurementStatus = SLAVO.MEASUREMENT_STATUS_MISSED_GOAL;
|
|
slaVo.processIconClass();
|
|
expect(slaVo.iconClass).toEqual('cross_circle_o');
|
|
}
|
|
|
|
it('should create object and test properties', function () {
|
|
|
|
slaVo = new SLAVO();
|
|
|
|
expect(slaVo.parentId).toEqual('');
|
|
expect(slaVo.title).toEqual('');
|
|
expect(slaVo.goal).toEqual('');
|
|
expect(slaVo.startTime).toEqual('');
|
|
expect(slaVo.endTime).toEqual('');
|
|
expect(slaVo.measurementStatus).toEqual('');
|
|
expect(slaVo.overallStopTime).toEqual('');
|
|
expect(slaVo.downStartTime).toEqual('');
|
|
expect(slaVo.upStartTime).toEqual('');
|
|
expect(slaVo.downElapsedTime).toEqual('');
|
|
expect(slaVo.upElapsedTime).toEqual('');
|
|
expect(slaVo.slaType).toEqual('');
|
|
expect(slaVo.iconClass).toEqual('');
|
|
expect(slaVo.position).toEqual('');
|
|
|
|
});
|
|
|
|
it('should set the icon class', function() {
|
|
|
|
setIcons();
|
|
|
|
});
|
|
|
|
it('should verify all the properties', function () {
|
|
|
|
var returnVal = slaVo.getProps();
|
|
expect(returnVal).toEqual([ 'id', 'createDate', 'parentId', 'title', 'goal', 'startTime', 'endTime', 'measurementStatus', 'overallStopTime', 'downStartTime', 'upStartTime', 'downElapsedTime', 'upElapsedTime', 'slaType', 'warningDate', 'warningPercentage' ]);
|
|
|
|
});
|
|
|
|
it('should test the post build features', function () {
|
|
|
|
spyObj = {
|
|
callFunction: setIcons
|
|
};
|
|
|
|
spyOn(spyObj, 'callFunction');
|
|
spyObj.callFunction();
|
|
|
|
slaVo.postBuild();
|
|
expect(spyObj.callFunction).toHaveBeenCalled();
|
|
|
|
});
|
|
}); |